introduction to actionscript3

Post on 19-Nov-2014

4.016 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

Adobe Platform Mastering

•Technology overview•AVM1 and AVM2•AS3 new features•AS2 migration to AS3•Coding samples•Performance tips•The future•Questions

Adobe Platform Mastering

•Flash Player 2 – timeline control commands•Flash Player 3 – load movie•Flash Player 4 – Full scripting implementation

(Actions, loops, variables, conditions)•Flash Player 5- AS1 (prototyped based on

ECMA, procedural and OOP)•Flash Player 6 – AS1 + Events model, RTMP

support, minor language improvements

Adobe Platform Mastering

•Flash Player 7 – AS2 introduction (ECMA4), inheritance, CSS support , FP6 support

•Flash Player 8 – AS1/AS2 improvements, mostly graphical, File uploads

•Flash Player 9(8.5) – AS3 introduction, AVM2, JIT compilation, Binary sockets, E4X, RegEx

•Flash Player 10, AIR – the future

Adobe Platform Mastering

•Introduced September 2003 – Flash MX 2004

•Features▫Compile time type checking▫Class based syntax▫Strict typing▫Inheritance▫ECMA 4 partially

Adobe Platform Mastering

•Introduced June 2006 – Adobe Flex 2•Features

▫New AVM2▫2 AVMs in FP9 player▫Performance improvement▫New bytecode compilation▫Packages support▫ECMA4 completely

Adobe Platform Mastering

Adobe Platform Mastering

•Performance▫Using strict typing▫Complete rewritten AVM▫Comparison example

•Sophistication▫Complete class support

•No hacks needed

Adobe Platform Mastering

•Evolution of Actionscript 2.0•Full re-engineered for performance•Final and Dynamic classes•Runtime exception•E4X•RegEx

Adobe Platform Mastering

•Type declaration required (warning)•Public, internal, protected, private, final•Packages •Constants•Int, Uint•* vs. Object•… parameter•More runtime and compile time errors•For each in (E4X)

Adobe Platform Mastering

•Completely re-write and organize•More object oriented•Event Model•Display tree exposed•Binary Socket•Binary Data – Bytes Array

•More: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/migration.html

Adobe Platform Mastering

•Display objects treated as objects▫Reparenting▫Handling without display▫Resource management…

•Dynamic content, removing idle actions•Loaded content (untrusted content)•System.totalmemory (process memory info)•Weak reference – listeners, Dictionary•Garbage collection reference:

http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html

Adobe Platform Mastering

•Flash CS3 •Flex 3

▫Actionscript project▫Flex project

•Flex SDK – open source•Flex SDK for player 10 beta

Adobe Platform Mastering

•FP9 SWF•FP10 SWF•Air application•Projector application

Adobe Platform Mastering

•Http▫Server side scripts (ASP, PHP), SOAP, REST▫Images, Progressive download▫File reference

•RTMP▫FMS, Red5 – streaming ▫Flash remoting

Adobe Platform Mastering

•Binary Sockets + binary data▫TCP, FTP, SMTP etc…

•External Interface▫Desktop application wrapper, Javascript

•Local Connection▫Communication between movies▫AVM1 – AVM2

•AIR

Adobe Platform Mastering

•Say goodbye to: attachAudio, attachBitmap, attachMovie, createEmptyMovieClip, createTextField, duplicateMovieClip, swapDepths, removeMovieClip

•Say hello to: DisplayObjectContainer, addChild, removeChild

Adobe Platform Mastering

Adobe Platform Mastering

•DisplayObject – base class, cannot contain additional DisplayObject

•InteractiveObject – supporting user interaction, such as buttons and text fields

•DisplayObjectContainer – can contain additional DisplayObject

•MovieClip – sprite with timeline•root => stage•Examples…

Adobe Platform Mastering

•AS2▫Callback : onLoad, onData, onPress▫Events: addListener

•AS3 ▫Events Model

Decoupling Asynchronic execution

▫No more Delegation

Adobe Platform Mastering

•Event System▫Event dispatcher▫Event listener▫Event object

•EventDispatcher class addEventListener dispatchEvent removeEventListener …

•Example…

Adobe Platform Mastering

•Event Propagation▫Capture▫At target ▫Bubbling▫Example…

•Event Object▫Creating custom events ▫Example…

Adobe Platform Mastering

•XML Structure▫Tree structure of data, built by nodes, properties and

values

•XML Loading▫URLLoader, URLRequest ▫XML

•Example…•XML Reading•XML Filtering

Adobe Platform Mastering

•XML Reading▫XML – direct data access▫XMLList – indirect data access (for each in, for)

Children() Attributes() Attribute(attName:String)

•XML Filtering▫Node values (name == value)▫Attributes (@attName == value)

•Examples…..

Adobe Platform Mastering

•Flash Player 10▫Communication▫File system access ▫Etc.

•Actionscript 4.0▫Array typing▫Union typing▫More primitives▫ECMA 4 compatible (December 2008 spec

release)▫And many more…..

top related