I spent the morning today reading up on the future of Flash over at Macromedia Labs. This new repository for pre-release alpha software is bursting with information on Flex 2, ActionScript 3, and the Flash 8.5 plugin. There are so many new features that will make the life of every AS developer so much easier. I almost wish they had waited on this. I’m still exploring Flash 8, and now I’ll be waiting like a little kid for Christmas to actually put AS3 in production.
A lot of people have mentioned interest in regular expressions and E4X, but I’m looking forward to getting rid of all the hacks required to code AS. Firstly, MovieClips are now instantiated like regular variables. We won’t be laughing at newbies when they try this little number anymore:
var mc:MovieClip = new MovieClip();
Not only that, but subclasses can be declared like that too. No more messing with prototypes to get a component on the Stage with only code. Likewise, we don’t need to assimilate root with that method anymore anymore either because now it can be the class of our choice. MovieClips have become so flexible that suddenly there’s a large inheritance chain of specialized display objects. It starts all the way down from a new EventDispatcher class, which acts as a base, and goes up though half a dozen levels that add functionality at each step. Macromedia highlighted a Sprite class which is a perfect lightweight version of MovieClip for components.
Unfortunately, just two days after I presented my new event model, Macromedia announces that they’ve redesigned events from the ground up. If a class has any sort of event in AS2, it uses the newer model in AS3. There goes my hatred for non-standard events. Moreover, Delegate is no longer needed to specify a listener function. It’s built right into addEventListener. Finally, while listener functions still receive a single event object as an argument, there’s a base Event class that we can subclass. I got my strong typing, even if I still have to use the object. They covered every point I made, so I intend to switch back to their version once AS3 officially comes out.
I noticed other interesting tidbits while I skimmed over the docs. There’s a new protected keyword that effectively has the same functionality that private does now. This makes private stronger by hiding members from subclasses too. There’s also a const keyword for making constants. Sealed classes make dynamic properties and methods impossible at runtime. As a language feature, this isn’t necessarily good or bad (I can see arguments both ways), but if a class is sealed, there will be a performance increase, and less memory will be needed in the player. I saw a couple new primitive types–int and uint. They’ll be very useful for when floating points aren’t needed. Lastly, for those of us that will be migrating our code, we’ll no doubt deal with the fact that the mx namespace has been reorganized. Macromedia added many new levels in there, and moved quite a few classes around.
In short, we ActionScript coders are going to be spoiled with so many new tools at our disposal. I’m sure I’ll wish I could build a site in AS3 well before it’s out in final form, but I’m glad we have a lot of time to experiment and learn about the new features. AS3 has matured well beyond it’s years, and its core library definately got a great overhaul. It’s a good time to be a Flash developer.
Good socket reasource here dude…..
http://blog.je2050.de/?p=39
:o)
Cam
Pingback: Discover ECMAScript 4: The Future of ActionScript - Zeus Labs