Despite his cold, Guy gave an excellent overview of the new AS3 features. I'll run through some of the most notable things he mentioned: - Flash Player 8.5 has two AVM's (ActionScript Virtual Machine), old SWF content runs using AVM and AS3 using the new highly optimized AVM+ - AS3 classes need you to define a package, no more long class names - you can have multiple classes in the same file as long as they are contained in the same package identifier - you still need the folder structure to reflect the package - trace() is now flash.utils.trace() - empty variables now return null instead of undefined - no more attachMovie etc. you can simply do new MovieClip() and it actually created a new movieclip instance *hoorah!*

var m:MovieClip = new MovieClip(); m.x = 100;

- this.addChild(new MovieClip()); vs this.createEmptyMovieClip(”test_mc”,1); - underscore properties are no morein AS3 (x vs _x, y vs _y, alpha vs _alpha) - drawing API is now in flash.display.Graphics - all instances of MovieClip and Sprite have a graphics property

var s:Sprite = new Sprite(); var g:Graphics = s.graphics;

- no more mx.utils.Delegate needed, 'this' now always references the instance in which method was defined - getURL is now navigateToUrl(new URLRequest("http://www.flashguru.co.uk")); - URLRequest class can specify HTTP headers etc. - LoadVars and LoadVariables now all handled through flash.net.URLLoader - EventType class with constants (e.g. EventType.COMPLETE = "complete"), compiler can handle this versus using a string - no more loadMovie in AS3 this becomes flash.display.Loader (for loading in gif, jpg, png, swf) - you can load external stuff off-stage (in memory) and add them to a DisplayList later when you want it to show

var l:Loader = new Loader(); l.load(new URLRequest("somemovie.swf")); this.addChild(l);

- everything except object subclasses EventDispatcher, no more nasty mix-ins - some other new features: DisplayList API, regular expressions, runtime error checking, sound spectrum analysis, retrieve full class info at runtime, new keywords and statements, more drawing API methods (drawRect), Timer class, create visual objects from binary data, E4X, low-level data access

Posted
AuthorPeter