Programming - Workshop 3

  • 348 views
Uploaded on

Third presentation on programming in Actionscript 3.0. We handle Strings and functions.

Third presentation on programming in Actionscript 3.0. We handle Strings and functions.

More in: Self Improvement
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
348
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
27
Comments
0
Likes
0

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 3
  • 2. So far we’ve seen... Variables Mathematical functions Boolean Logic Loops Conditionals Arrays Strings Functions
  • 3. Arrays fruits.push(); fruits.unshift(); fruits.pop(); fruits.shift(); fruits.splice(); fruits.concat(); fruits.length; fruits.toString();
  • 4. Procedural programming Strings
  • 5. var welcome:String = “Hyper Island”;
  • 6. var welcome:String = “Hyper Island”; H y p e r I s l a n d
  • 7. var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 8. Value of an index var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 9. Value of an index var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.charAt(8);
  • 10. Value of an index var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.charAt(8);
  • 11. Value of an index var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.charAt(8);
  • 12. Value of an index var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.charAt(8); variable answer has value ”l”
  • 13. Index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 14. Index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:uint = welcome.indexOf(‘e’);
  • 15. Index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:uint = welcome.indexOf(‘e’);
  • 16. Index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:uint = welcome.indexOf(‘e’);
  • 17. Index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:uint = welcome.indexOf(‘e’); variable answer has value 3
  • 18. First index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 19. First index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.indexOf(‘e’);
  • 20. First index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.indexOf(‘e’);
  • 21. First index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.indexOf(‘e’);
  • 22. First index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.indexOf(‘e’); variable answer has value 3
  • 23. First index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.indexOf(‘e’); variable answer has value 3
  • 24. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 25. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘e’);
  • 26. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘e’);
  • 27. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘e’);
  • 28. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘e’); variable answer has value 3
  • 29. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘e’); variable answer has value 3
  • 30. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 31. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘z’);
  • 32. Last index of a value var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:int = welcome.lastIndexOf(‘z’); variable answer has value -1
  • 33. Slicing an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 34. Slicing an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.slice(2,8);
  • 35. Slicing an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.slice(2,8);
  • 36. Slicing an array var welcome:String = “Hyper Island”; p e r I s 2 3 4 5 6 7 var answer:String = welcome.slice(2,8);
  • 37. Slicing an array var welcome:String = “Hyper Island”; p e r I s 2 3 4 5 6 7 var answer:String = welcome.slice(2,8); variable answer has value “per Is”
  • 38. Splitting an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 39. Splitting an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:Array = welcome.split(7);
  • 40. Splitting an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:Array = welcome.split(7); variable answer has value
  • 41. Splitting an array var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:Array = welcome.split(7); variable answer has value “Hyper I” “sland”
  • 42. Making a substring var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11
  • 43. Making a substring var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.substr(3,4);
  • 44. Making a substring var welcome:String = “Hyper Island”; H y p e r I s l a n d 0 1 2 3 4 5 6 7 8 9 10 11 var answer:String = welcome.substr(3,4);
  • 45. Making a substring var welcome:String = “Hyper Island”; e r I 3 4 5 6 var answer:String = welcome.substr(3,4);
  • 46. Making a substring var welcome:String = “Hyper Island”; e r I 3 4 5 6 var answer:String = welcome.substr(3,4); variable answer has value “er l”
  • 47. Making a substring var welcome:String = “Hyper Island”; e r I 3 4 5 6 1 2 3 4 var answer:String = welcome.substr(3,4); variable answer has value “er l”
  • 48. Making a substring var welcome:String = “Hyper Island”; e r I 3 4 var answer:String = welcome.substr(3,4); variable answer has value “er l”
  • 49. Making a substring var welcome:String = “Hyper Island”; e r I 3 4 var answer:String = welcome.substr(3,4); variable answer has value “er l”
  • 50. Strings answer.charAt(8); answer.indexOf(‘e’); answer.lastIndexOf(‘e’); answer.slice(8); answer.split(8); answer.substr(5);
  • 51. Procedural programming Functions
  • 52. function name(parameter:Paramtype, ...):ReturnType { // *** MAGIC *** }
  • 53. function makeHyperIslandEmailAddress (name:String, surname:String):String { var emailAddress:String = name + “.” + surname + ‘@hyperisland.se’; return emailAddress; }
  • 54. RTFM! Check the docs!
  • 55. Exercise 10 Awesomeness!
  • 56. No homework, but please... Overlook it... Experiment with it... Ask questions! Remember: this is only the start! So please, get this!
  • 57. Q&A
  • 58. Thanks!