Your SlideShare is downloading. ×
Programming - Workshop 1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Programming - Workshop 1

1,769
views

Published on

This is the first part of my workshop on programming. We start from scratch, explaining introducing programming in Actionscript 3, the programming process, variables, boolean logic, loops and …

This is the first part of my workshop on programming. We start from scratch, explaining introducing programming in Actionscript 3, the programming process, variables, boolean logic, loops and mathematical functions.

Published in: Education, Technology

0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,769
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
161
Comments
0
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Programming Cas Lemmens - Workshop 1
  • 2. About me Cas Lemmens Got my knowledge on Programming by Studying Computer Science at the university of Ghent Studying and working with frameworks Playing around in Flash
  • 3. Why this workshop? Lots of demand We can build great things! I feel lonely Good point on your CV
  • 4. The goal Learn programming ffs! Learning Object Oriented Programming Learning Model - View - Controller Managing a programming project Exploring the Flash & Flex libraries
  • 5. Planning Introduction to Flash/AS3 Constructor Programming process Properties Procedural programming Object Oriented programming Variables Idea Mathematical functions Inheritance Boolean Logic Datatypes & Type checking Loops Interfaces Conditionals Static classses Arrays Methods & scopes Methods Namespaces & packages Object based programming Events Classes Model - View - Controller Packages Doing a programming project Access control Flash & Flex libraries
  • 6. Planning Introduction to Flash/AS3 Constructor Programming process Properties Procedural programming Object Oriented programming Variables Idea Mathematical functions Inheritance Boolean Logic Datatypes & Type checking Loops Interfaces Conditionals Static classses Arrays Methods & scopes Methods Namespaces & packages Object based programming Events Classes Model - View - Controller Packages Doing a programming project Access control Flash & Flex libraries
  • 7. Before we start... Code-lover ≠ Code-expert Ask questions! Tell me when I have to slow down! Try to focus on the global method Experiment!!
  • 8. Introduction to Flash & Actionscript 3
  • 9. Why Actionscript 3? Lots of demand Great learning language Used in Flash, Flex and After Effects
  • 10. Other languages Web-based Application based Script languages PHP Java Javascript ASP C, C++, Obective Applescript C, C# Ruby Lingo Python JSP Perl ...
  • 11. Other languages Web-based Application based Script languages PHP Java Javascript ASP C, C++, Obective Applescript C, C# Ruby Lingo Python JSP Perl ... OOP MVC OOP MVC proof proof proof proof
  • 12. How to program in Flash?
  • 13. How to program in Flash?
  • 14. How to program in Flash? Library Text Buttons
  • 15. How to program in Flash? Library Text Buttons
  • 16. How to program in Flash? Library Text Buttons
  • 17. How to program in Flash? Library Text Buttons
  • 18. How to program in Flash?eline Tim based Library Text Buttons
  • 19. How to program in Flash?
  • 20. How to program in Flash? Library Text Buttons
  • 21. How to program in Flash? Source Library Text Buttons
  • 22. How to program in Flash? Source Library Text Buttons
  • 23. How to program in Flash? Source Library Text Buttons
  • 24. How to program in Flash?ject Ob based Source Library Text Buttons
  • 25. Programming process
  • 26. Writing
  • 27. Think! Writing
  • 28. Think! Writing Compile
  • 29. Think! Writing Compile ! Error
  • 30. Think! Success Writing ✓ Compile ! Error
  • 31. Think! Success Writing ✓ Compile Testing ! Error
  • 32. Think! Success Writing ✓ Compile Testing ! ! Error Error
  • 33. Think! Success Success Writing ✓ ✓ Compile Testing Done! ! ! Error Error
  • 34. Think! Success Success Writing ✓ ✓ Compile Testing Done! ! ! Error Debugging Error
  • 35. Writing
  • 36. Writing
  • 37. Writing
  • 38. Writing Compile
  • 39. Writing Compile
  • 40. Writing Compile
  • 41. Writing Compile Debug
  • 42. Writing Compile Debug
  • 43. Writing Compile Debug
  • 44. Writing Compile Debug Testing
  • 45. Writing Compile Debug Testing
  • 46. Writing Compile Debug Testing
  • 47. Writing Compile Debug Testing Debug
  • 48. Writing Compile Debug Testing Debug
  • 49. Exercise 1 Hello world!
  • 50. Some tips before we start: comment! For a single line comment: // this is my comment For multiple line comments: /* I can write my comment across multiple lines */
  • 51. Procedural programming Variables
  • 52. var welcome:String = “Hello World!”;
  • 53. var welcome:String = “Hello World!”; keyword for defining a new variable
  • 54. var welcome welcome:String = “Hello World!”;
  • 55. var welcome welcome:String = “Hello World!”; name of the variable no capital as first letter! no number as first letter! symbols for special reason separate words by capitals e.g. welcomeText and not welcometext
  • 56. var welcome:String = “Hello World!”; String
  • 57. var welcome:String = “Hello World!”; String type of the variable defines characteristics defines abilities
  • 58. Native types of variables String: textual data (string or character) Boolean: logical states (true or false) Number: floating point numbers (fractional) int: integer numbers uint: positive integer numbers Array: an ordered list Error: a program error Date: specific point in time Math: common mathematical operations RegExp: tool for searching and replacing Function: reusable set of instructions Object: default basic features
  • 59. Native types of variables String: textual data (string or character) Boolean: logical states (true or false) Number: floating point numbers (fractional) int: integer numbers uint: positive integer numbers Array: an ordered list Error: a program error Date: specific point in time Math: common mathematical operations RegExp: tool for searching and replacing Function: reusable set of instructions Object: default basic features
  • 60. var welcome:String = “Hello World!” World!”;
  • 61. var welcome:String = “Hello World!” World!”; value of the variable
  • 62. var welcome:String = “Hello World!”; This defines the variable welcome with the value “Hello World!”
  • 63. var welcome:String = “Hello World!”; PHP $welcome = “Hello World!”; C# string welcome = “Hello World!”;
  • 64. var welcome:String = “Hello World!”;
  • 65. var welcome:String = “Hello World!”; var welcome:Boolean = true;
  • 66. var welcome:String = “Hello World!”; var welcome:Boolean = true; var welcome:Number = 2.34;
  • 67. var welcome:String = “Hello World!”; var welcome:Boolean = true; var welcome:Number = 2.34; var welcome:int = -5;
  • 68. var welcome:String = “Hello World!”; var welcome:Boolean = true; var welcome:Number = 2.34; var welcome:int = -5; var welcome:uint = 3;
  • 69. Exercise 2 Variables
  • 70. Procedural programming Mathematical functions
  • 71. Doing the math!
  • 72. Doing the math! var player1:Number = 6;
  • 73. Doing the math! var player1:Number = 6; var player2:Number = 2;
  • 74. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number =
  • 75. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 + player2;
  • 76. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 + player2; result is 8
  • 77. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number =
  • 78. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 - player2;
  • 79. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 - player2; result is 4
  • 80. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number =
  • 81. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 * player2;
  • 82. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 * player2; result is 12
  • 83. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number =
  • 84. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 / player2;
  • 85. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 / player2; result is 3
  • 86. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number =
  • 87. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 % player2;
  • 88. Doing the math! var player1:Number = 6; var player2:Number = 2; var result:Number = player1 % player2; result is 0
  • 89. Doing the math! var player1:Number = 5; var player2:Number = 2; var result:Number =
  • 90. Doing the math! var player1:Number = 5; var player2:Number = 2; var result:Number =
  • 91. Doing the math! var player1:Number = 5; var player2:Number = 2; var result:Number = player1 % player2;
  • 92. Doing the math! var player1:Number = 5; var player2:Number = 2; var result:Number = player1 % player2; result is 1
  • 93. Exercise 3 Math class!
  • 94. Procedural programming Boolean logic
  • 95. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean =
  • 96. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean =
  • 97. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 > player2;
  • 98. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 > player2; result is true
  • 99. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 > player2; Bigge r result is true than
  • 100. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean =
  • 101. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 < player2;
  • 102. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 < player2; result is false
  • 103. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 < player2; Smal ler result is false than
  • 104. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean =
  • 105. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 <= player2;
  • 106. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 <= player2; result is false
  • 107. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 <= player2; Smal ler or eq ual result is false than
  • 108. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean =
  • 109. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 >= player2;
  • 110. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 >= player2; result is true
  • 111. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 >= player2; Bigge r or eq ual result is true than
  • 112. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean =
  • 113. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 == player2;
  • 114. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 == player2; result is false
  • 115. Boolean logic var player1:Number = 5; var player2:Number = 2; var result:Boolean = player1 == player2; Equa l to result is false
  • 116. player1 == 5 player1 = 5
  • 117. Condition: returns true or false. Values remain unchanged! player1 == 5 player1 = 5
  • 118. Condition: returns true or false. Values remain unchanged! player1 == 5 Variable player1 gets the value 5. Values change! player1 = 5
  • 119. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean =
  • 120. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = player1 || player2;
  • 121. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = player1 || player2; result is true
  • 122. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = player1 || player2; OR result is true
  • 123. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean =
  • 124. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = player1 && player2;
  • 125. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = player1 && player2; result is false
  • 126. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = player1 && player2; AND result is false
  • 127. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean =
  • 128. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = !player1;
  • 129. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = !player1; result is false
  • 130. Boolean logic var player1:Boolean = true; var player2:Boolean = false; var result:Boolean = !player1; NOT result is false
  • 131. Exercise 4 Boolean logic
  • 132. false && false =
  • 133. false && false = false
  • 134. false && false = false true || false || true =
  • 135. false && false = false true || false || true = true
  • 136. false && false = false true || false || true = true !true || false || false =
  • 137. false && false = false true || false || true = true !true || false || false = false
  • 138. false && false = false true || false || true = true !true || false || false = false !false && true && true =
  • 139. false && false = false true || false || true = true !true || false || false = false !false && true && true = true
  • 140. false && false = false true || false || true = true !true || false || false = false !false && true && true = true (true || false) && false =
  • 141. false && false = false true || false || true = true !true || false || false = false !false && true && true = true (true || false) && false = false
  • 142. false && false = false true || false || true = true !true || false || false = false !false && true && true = true (true || false) && false = false !(false && false) || false =
  • 143. false && false = false true || false || true = true !true || false || false = false !false && true && true = true (true || false) && false = false !(false && false) || false = false
  • 144. false && false = false true || false || true = true !true || false || false = false !false && true && true = true (true || false) && false = false !(false && false) || false = false !(true || ((!false && true) || true)) =
  • 145. false && false = false true || false || true = true !true || false || false = false !false && true && true = true (true || false) && false = false !(false && false) || false = false !(true || ((!false && true) || true)) = false
  • 146. 5 < 9
  • 147. 5 < 9 true
  • 148. 5 < 9 true 5 > 5
  • 149. 5 < 9 true 5 > 5 false
  • 150. 5 < 9 true 5 > 5 false 5 >= 5
  • 151. 5 < 9 true 5 > 5 false 5 >= 5 true
  • 152. 5 < 9 true 5 > 5 false 5 >= 5 true 5 != 5
  • 153. 5 < 9 true 5 > 5 false 5 >= 5 true 5 != 5 false
  • 154. 5 < 9 true 5 > 5 false 5 >= 5 true 5 != 5 false (3 < 2) && (7 >= 7)
  • 155. 5 < 9 true 5 > 5 false 5 >= 5 true 5 != 5 false (3 < 2) && (7 >= 7) false
  • 156. 5 < 9 true 5 > 5 false 5 >= 5 true 5 != 5 false (3 < 2) && (7 >= 7) false !(5 <= 3) || ((5 > 3) && (3 > 2))
  • 157. 5 < 9 true 5 > 5 false 5 >= 5 true 5 != 5 false (3 < 2) && (7 >= 7) false !(5 <= 3) || ((5 > 3) && (3 > 2)) true
  • 158. Procedural programming Loops
  • 159. How can I display this? 1x6= 6 2 x 6 = 12 3 x 6 = 18 4 x 6 = 24 5 x 6 = 30 6 x 6 = 36 7 x 6 = 42 8 x 6 = 48 9 x 6 = 52 10 x 6 = 60
  • 160. Common loops While-loop For-loop Switch-loop Do while-loop
  • 161. while loop while(condition) { // Do something } The loop will keep on going until the condition is false.
  • 162. How can I display this? 1x6= 6 2 x 6 = 12 3 x 6 = 18 4 x 6 = 24 5 x 6 = 30 6 x 6 = 36 7 x 6 = 42 8 x 6 = 48 9 x 6 = 52 10 x 6 = 60
  • 163. while loop while(condition) { // Do something }
  • 164. while loop var counter:Number = 1; while(condition) { // Do something }
  • 165. while loop var counter:Number = 1; while(counter < 11) { // Do something }
  • 166. while loop var counter:Number = 1; while(counter <= 10) { // Do something }
  • 167. while loop var counter:Number = 1; var table:Number = 6; while(counter <= 10) { // Do something }
  • 168. while loop var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); }
  • 169. Exercise 5 While loop
  • 170. while loop ! Infinite loop
  • 171. while loop var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); }
  • 172. while loop var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 173. for loop for(initialize, condition, update) { // Do something } The loop will start with the initialization, and do the update after every loop. The loop will keep on going until the condition is falls.
  • 174. for loop for(initialize, condition, update) { // Do something }
  • 175. for loop 1 for(initialize, condition, update) { // Do something }
  • 176. for loop 1 for(initialize, condition, 2 update) { // Do something }
  • 177. for loop 1 for(initialize, condition, 2 update) { // Do something 3 }
  • 178. for loop 1 for(initialize, condition, 2 update) 4 { // Do something 3 }
  • 179. for loop 1 for(initialize, condition, 2 update) 4 { // Do something 3 }
  • 180. What did we initialize before the loop? var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 181. What did we initialize before the loop? 1 var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 182. for loop 1 for(initialize, condition, 2 update) 4 { // Do something 3 }
  • 183. for loop 1 for(var counter:Number = 1, condition, 2 update) 4 { // Do something 3 }
  • 184. What was the condition? 1 var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 185. What was the condition? 1 var counter:Number = 1; var table:Number = 6; while(counter <= 10) 2 { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 186. for loop 1 for(var counter:Number = 1, condition, 2 update) 4 { // Do something 3 }
  • 187. for loop 1 for(var counter:Number = 1, counter <= 10, 2 update) 4 { // Do something 3 }
  • 188. What did we do, and what did we update? 1 var counter:Number = 1; var table:Number = 6; while(counter <= 10) 2 { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 189. What did we do, and what did we update? 1 var counter:Number = 1; var table:Number = 6; while(counter <= 10) 2 { 3 trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 190. What did we do, and what did we update? 1 var counter:Number = 1; var table:Number = 6; while(counter <= 10) 2 { 3 trace(counter + “ x “ + table + “ = “ + (counter * table)); 4 counter = counter + 1; }
  • 191. for loop 1 for(var counter:Number = 1, counter <= 10, 2 update) 4 { // Do something 3 }
  • 192. for loop 1 for(var counter:Number = 1, counter <= 10, 2 update) 4 { trace(counter + “ x “ + table + “ = “ + (counter * table)); 3 }
  • 193. for loop 1 for(var counter:Number = 1, counter <= 10, 2 counter = counter + 1) 4 { trace(counter + “ x “ + table + “ = “ + (counter * table)); 3 }
  • 194. while-loop var counter:Number = 1; var table:Number = 6; while(counter <= 10) { trace(counter + “ x “ + table + “ = “ + (counter * table)); counter = counter + 1; }
  • 195. while-loop for-loop var counter:Number = 1; for(var counter:Number = 1, var table:Number = 6; counter <= 10, while(counter <= 10) counter = counter + 1) { { trace(counter + “ x “ + trace(counter + “ x “ + table + “ = “ + table + “ = “ + (counter * table)); (counter * table)); counter = counter + 1; } }
  • 196. while-loop for-loop var counter:Number = 1; for(var counter:Number = 1, var table:Number = 6; counter <= 10, while(counter <= 10) counter = counter + 1) { { trace(counter + “ x “ + trace(counter + “ x “ + table + “ = “ + table + “ = “ + (counter * table)); (counter * table)); counter = counter + 1; } } Initialization
  • 197. while-loop for-loop var counter:Number = 1; for(var counter:Number = 1, var table:Number = 6; counter <= 10, while(counter <= 10) counter = counter + 1) { { trace(counter + “ x “ + trace(counter + “ x “ + table + “ = “ + table + “ = “ + (counter * table)); (counter * table)); counter = counter + 1; } } Initialization Condition
  • 198. while-loop for-loop var counter:Number = 1; for(var counter:Number = 1, var table:Number = 6; counter <= 10, while(counter <= 10) counter = counter + 1) { { trace(counter + “ x “ + trace(counter + “ x “ + table + “ = “ + table + “ = “ + (counter * table)); (counter * table)); counter = counter + 1; } } Initialization Condition Update
  • 199. Exercise 6 For loop
  • 200. No homework, but please... Overlook it... Experiment with it... Ask questions! Remember: this is only the start! So please, get this!
  • 201. Q&A
  • 202. Thanks!