Introduction to Actionscript3

3,293 views

Published on

Introduction to ActionScript3, differences from ActionScript2, פלאש

Published in: Technology
4 Comments
7 Likes
Statistics
Notes
No Downloads
Views
Total views
3,293
On SlideShare
0
From Embeds
0
Number of Embeds
45
Actions
Shares
0
Downloads
55
Comments
4
Likes
7
Embeds 0
No embeds

No notes for slide
  • Introduction to Actionscript3

    1. 2. <ul><li>Technology overview </li></ul><ul><li>AVM1 and AVM2 </li></ul><ul><li>AS3 new features </li></ul><ul><li>AS2 migration to AS3 </li></ul><ul><li>Coding samples </li></ul><ul><li>Performance tips </li></ul><ul><li>The future </li></ul><ul><li>Questions </li></ul>
    2. 3. <ul><li>Flash Player 2 – timeline control commands </li></ul><ul><li>Flash Player 3 – load movie </li></ul><ul><li>Flash Player 4 – Full scripting implementation (Actions, loops, variables, conditions) </li></ul><ul><li>Flash Player 5- AS1 (prototyped based on ECMA, procedural and OOP) </li></ul><ul><li>Flash Player 6 – AS1 + Events model, RTMP support, minor language improvements </li></ul>
    3. 4. <ul><li>Flash Player 7 – AS2 introduction (ECMA4), inheritance, CSS support , FP6 support </li></ul><ul><li>Flash Player 8 – AS1/AS2 improvements, mostly graphical, File uploads </li></ul><ul><li>Flash Player 9(8.5) – AS3 introduction, AVM2, JIT compilation, Binary sockets, E4X, RegEx </li></ul><ul><li>Flash Player 10, AIR – the future </li></ul>
    4. 5. <ul><li>Introduced September 2003 – Flash MX 2004 </li></ul><ul><li>Features </li></ul><ul><ul><li>Compile time type checking </li></ul></ul><ul><ul><li>Class based syntax </li></ul></ul><ul><ul><li>Strict typing </li></ul></ul><ul><ul><li>Inheritance </li></ul></ul><ul><ul><li>ECMA 4 partially </li></ul></ul>
    5. 6. <ul><li>Introduced June 2006 – Adobe Flex 2 </li></ul><ul><li>Features </li></ul><ul><ul><li>New AVM2 </li></ul></ul><ul><ul><li>2 AVMs in FP9 player </li></ul></ul><ul><ul><li>Performance improvement </li></ul></ul><ul><ul><li>New bytecode compilation </li></ul></ul><ul><ul><li>Packages support </li></ul></ul><ul><ul><li>ECMA4 completely </li></ul></ul>
    6. 8. <ul><li>Performance </li></ul><ul><ul><li>Using strict typing </li></ul></ul><ul><ul><li>Complete rewritten AVM </li></ul></ul><ul><ul><li>Comparison example </li></ul></ul><ul><li>Sophistication </li></ul><ul><ul><li>Complete class support </li></ul></ul><ul><li>No hacks needed </li></ul>
    7. 9. <ul><li>Evolution of Actionscript 2.0 </li></ul><ul><li>Full re-engineered for performance </li></ul><ul><li>Final and Dynamic classes </li></ul><ul><li>Runtime exception </li></ul><ul><li>E4X </li></ul><ul><li>RegEx </li></ul>
    8. 10. <ul><li>Type declaration required (warning) </li></ul><ul><li>Public, internal, protected, private, final </li></ul><ul><li>Packages </li></ul><ul><li>Constants </li></ul><ul><li>Int, Uint </li></ul><ul><li>* vs. Object </li></ul><ul><li>… parameter </li></ul><ul><li>More runtime and compile time errors </li></ul><ul><li>For each in (E4X) </li></ul>
    9. 11. <ul><li>Completely re-write and organize </li></ul><ul><li>More object oriented </li></ul><ul><li>Event Model </li></ul><ul><li>Display tree exposed </li></ul><ul><li>Binary Socket </li></ul><ul><li>Binary Data – Bytes Array </li></ul><ul><li>More: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/migration.html </li></ul>
    10. 12. <ul><li>Display objects treated as objects </li></ul><ul><ul><li>Reparenting </li></ul></ul><ul><ul><li>Handling without display </li></ul></ul><ul><ul><li>Resource management… </li></ul></ul><ul><li>Dynamic content, removing idle actions </li></ul><ul><li>Loaded content (untrusted content) </li></ul><ul><li>System.totalmemory (process memory info) </li></ul><ul><li>Weak reference – listeners, Dictionary </li></ul><ul><li>Garbage collection reference: http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html </li></ul>
    11. 13. <ul><li>Flash CS3 </li></ul><ul><li>Flex 3 </li></ul><ul><ul><li>Actionscript project </li></ul></ul><ul><ul><li>Flex project </li></ul></ul><ul><li>Flex SDK – open source </li></ul><ul><li>Flex SDK for player 10 beta </li></ul>
    12. 14. <ul><li>FP9 SWF </li></ul><ul><li>FP10 SWF </li></ul><ul><li>Air application </li></ul><ul><li>Projector application </li></ul>
    13. 15. <ul><li>Http </li></ul><ul><ul><li>Server side scripts (ASP, PHP), SOAP, REST </li></ul></ul><ul><ul><li>Images, Progressive download </li></ul></ul><ul><ul><li>File reference </li></ul></ul><ul><li>RTMP </li></ul><ul><ul><li>FMS, Red5 – streaming </li></ul></ul><ul><ul><li>Flash remoting </li></ul></ul>
    14. 16. <ul><li>Binary Sockets + binary data </li></ul><ul><ul><li>TCP, FTP, SMTP etc… </li></ul></ul><ul><li>External Interface </li></ul><ul><ul><li>Desktop application wrapper, Javascript </li></ul></ul><ul><li>Local Connection </li></ul><ul><ul><li>Communication between movies </li></ul></ul><ul><ul><li>AVM1 – AVM2 </li></ul></ul><ul><li>AIR </li></ul>
    15. 17. <ul><li>Say goodbye to: attachAudio, attachBitmap, attachMovie, createEmptyMovieClip, createTextField, duplicateMovieClip, swapDepths, removeMovieClip </li></ul><ul><li>Say hello to: DisplayObjectContainer, addChild, removeChild </li></ul>
    16. 19. <ul><li>DisplayObject – base class, cannot contain additional DisplayObject </li></ul><ul><li>InteractiveObject – supporting user interaction, such as buttons and text fields </li></ul><ul><li>DisplayObjectContainer – can contain additional DisplayObject </li></ul><ul><li>MovieClip – sprite with timeline </li></ul><ul><li>root => stage </li></ul><ul><li>Examples… </li></ul>
    17. 20. <ul><li>AS2 </li></ul><ul><ul><li>Callback : onLoad, onData, onPress </li></ul></ul><ul><ul><li>Events: addListener </li></ul></ul><ul><li>AS3 </li></ul><ul><ul><li>Events Model </li></ul></ul><ul><ul><ul><li>Decoupling </li></ul></ul></ul><ul><ul><ul><li>Asynchronic execution </li></ul></ul></ul><ul><ul><li>No more Delegation </li></ul></ul>
    18. 21. <ul><li>Event System </li></ul><ul><ul><li>Event dispatcher </li></ul></ul><ul><ul><li>Event listener </li></ul></ul><ul><ul><li>Event object </li></ul></ul><ul><li>EventDispatcher class </li></ul><ul><ul><ul><li>addEventListener </li></ul></ul></ul><ul><ul><ul><li>dispatchEvent </li></ul></ul></ul><ul><ul><ul><li>removeEventListener </li></ul></ul></ul><ul><ul><ul><li>… </li></ul></ul></ul><ul><li>Example… </li></ul>
    19. 22. <ul><li>Event Propagation </li></ul><ul><ul><li>Capture </li></ul></ul><ul><ul><li>At target </li></ul></ul><ul><ul><li>Bubbling </li></ul></ul><ul><ul><li>Example… </li></ul></ul><ul><li>Event Object </li></ul><ul><ul><li>Creating custom events </li></ul></ul><ul><ul><li>Example… </li></ul></ul>
    20. 23. <ul><li>XML Structure </li></ul><ul><ul><li>Tree structure of data, built by nodes, properties and values </li></ul></ul><ul><li>XML Loading </li></ul><ul><ul><li>URLLoader, URLRequest </li></ul></ul><ul><ul><li>XML </li></ul></ul><ul><li>Example… </li></ul><ul><li>XML Reading </li></ul><ul><li>XML Filtering </li></ul>
    21. 24. <ul><li>XML Reading </li></ul><ul><ul><li>XML – direct data access </li></ul></ul><ul><ul><li>XMLList – indirect data access (for each in, for) </li></ul></ul><ul><ul><ul><li>Children() </li></ul></ul></ul><ul><ul><ul><li>Attributes() </li></ul></ul></ul><ul><ul><ul><li>Attribute(attName:String) </li></ul></ul></ul><ul><li>XML Filtering </li></ul><ul><ul><li>Node values (name == value) </li></ul></ul><ul><ul><li>Attributes (@attName == value) </li></ul></ul><ul><li>Examples….. </li></ul>
    22. 25. <ul><li>Flash Player 10 </li></ul><ul><ul><li>Communication </li></ul></ul><ul><ul><li>File system access </li></ul></ul><ul><ul><li>Etc. </li></ul></ul><ul><li>Actionscript 4.0 </li></ul><ul><ul><li>Array typing </li></ul></ul><ul><ul><li>Union typing </li></ul></ul><ul><ul><li>More primitives </li></ul></ul><ul><ul><li>ECMA 4 compatible (December 2008 spec release) </li></ul></ul><ul><ul><li>And many more….. </li></ul></ul>

    ×