Creative Programming in ActionScript 3.0

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    9 Favorites

    Creative Programming in ActionScript 3.0 - Presentation Transcript

    1. Creative Programming in ActionScript 3.0
    2. • Flash Platform Consultant • Lecturer Devine • Adobe Community Expert • Technical author • Full time web geek
    3. Creativity is a mental process involving the generation of new ideas or concepts, or new associations of the creative mind between existing ideas or concepts.
    4. Programming is a the process of writing, testing, debugging and maintaining the source code of computer programs.
    5. What will we talk about? • Object-Oriented Programming • Classes and instances • Inheritance • Encapsulation • Basic trigonometry • Distance between points • Polar and Cartesian coordinates • Experimentation • BitmapData • Sound Spectrum
    6. Object-Oriented Programming
    7. Classes and instances
    8. Classes • Classes are blueprints of functionality • Allow for reusable and modular code • Contain methods (functions) and properties (variables) Ball class
    9. Instances • Instances (objects) are copies based on a class blueprint • Instance property values are independent of its class Ball class Ball instance Ball instance Ball instance
    10. Example (Library panel)
    11. HelloWorld.as package { public class HelloWorld { public var name:String; public function HelloWorld(value:String) { this.name = value; trace(“Hello world from “+ this.name); } } }
    12. HelloWorld instances var myWorld:HelloWorld = new HelloWorld(“Peter”); // Hello world from Peter trace(myWorld.name); // Peter var otherWorld:HelloWorld = new HelloWorld(“Barack”); // Hello world from Barack trace(myWorld.name); // Barack
    13. Inheritance • Classes can extend each others functionality • Each class can only inherit from one super class • Use the “extends” keyword Animal class Dog class Cat class Tiger class
    14. Example (inheritance.fla)
    15. Encapsulation • Protect the inner workings of your class • Access modifiers (public, private, protected, internal) • Use getter/setter methods to provide access getter/setter other class class internals
    16. Access modifiers • public - accessible from anywhere • private - only accessible from within the class • protected - only accessible within class and subclasses • internal - only accessible within same package (default)
    17. Getter/setters • Looks like a method, behaves like a property • Provides a single entry point for setting a property • Useful for input validation private var _age:Number; public function get age():Number { return this._age; } public function set age(val:Number):void { if(val >= 18) { this._age = val; } else { trace(“you are too young”); } }
    18. Account.as package { public class Account { private var _email:String; public function set email(val:String):void { if(val.indexOf(“@”) != -1) { this._email = val; } else { trace(“invalid email”); } } } } var myAccount:Account = new Account(); myAccount.email = “peter.elst@gmail.com”;
    19. Basic Trigonometry
    20. Distance between points point 2 point 1
    21. Distance between points point 2 C B point 1 A
    22. A² + B² = C²
    23. √ d(P1,
P2)
=



(x2
‐
x1)2
+
(y 
–
y )
2 2 1
    24. Example (distance.fla)
    25. Cartesian coordinates (x,y) x y
    26. Polar coordinates (r, θ) r θ
    27. A² + B² = C² (r, θ) C B θ A
    28. Converting polar coordinates x
=
Math.cos(θ)
*
radius y
=
Math.sin(θ)
*
radius θ
is
the
angle
in
radians
    29. Example (polar-animation.fla)
    30. Experimentation
    31. flash.display.BitmapData • Allows you to get pixel level access to bitmaps • Work with color channels • Perform bitmap operations
    32. SoundMixer.computeSpectrum • Returns spectrum information of sound • ByteArray with floating point values between -1 and 1 • Raw wave form or Fast Fourier Transform (FFT) • Doesn’t work for microphone input (yet) :( • see www.getmicrophone.com
    33. Books Foundation ActionScript 3.0 Animation “Making Things Move” Object-Oriented ActionScript 3.0 Websites www.gotoandlearn.com www.levitated.net Get in touch Email: peter.elst@gmail.com Blog: www.peterelst.com Twitter: peterelst Thank you!

    + Peter ElstPeter Elst, 6 months ago

    custom

    3092 views, 9 favs, 9 embeds more stats

    More info about this document

    CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

    Go to text version

    • Total Views 3092
      • 1935 on SlideShare
      • 1157 from embeds
    • Comments 0
    • Favorites 9
    • Downloads 97
    Most viewed embeds
    • 726 views on http://www.peterelst.com
    • 248 views on http://flashz-13.blogspot.com
    • 175 views on http://injun.ru
    • 2 views on http://xss.yandex.net
    • 2 views on http://2designer.ru

    more

    All embeds
    • 726 views on http://www.peterelst.com
    • 248 views on http://flashz-13.blogspot.com
    • 175 views on http://injun.ru
    • 2 views on http://xss.yandex.net
    • 2 views on http://2designer.ru
    • 1 views on http://static.slidesharecdn.com
    • 1 views on http://stapj56:8888
    • 1 views on http://googlemail.com
    • 1 views on http://www.flashz-13.blogspot.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories