…it’s here. It sure took its time.

Essential ActionScript 3.0

The jump from ActionScript 2.0 to ActionScript 3.0 is a big one. Despite bigger syntactical and structural similarities, it’s a much wider gap than the one we had to go through from ActionScript 1 to ActionScript 2 because it can’t be done gradually – old code is not compatible – and it can require some major rethinking on how websites are structured, as it forces you to do everything the right way.

Luckily, the structure of all my AS2 work nowadays closely resembles the structure an AS3 project demands of you; there are some big amounts of abstraction employed on the projects I do (even if the functionality as well as the interface itself are not the ones you’d expect on your run-of-the-mill user interfaces) and the new language seems specially fit for that kind of heavy OOP work, as I have been doing some heavy AS3 work on personal projects and I have grown quite happy with it.

The truth is, I once believed a more orthodox approach to OOP wouldn’t be practical on extremely custom user interfaces, but it has proven that given time and with the right amount of planning and framework building – I have my own collection of classes I reuse on every new project – project building and maintenance can become a piece of cake. Still lengthy and demanding, of course, but with platform frustration kept to a minimum.

The existing AS3 documentation is the big problem; I was just waiting for the book to arrive to take my AS3 usage to the next step. The transition will be a bit painful – and hey, the book is huge! – but I’m confident the grass will grow in a much greener fashion once it is completed.

5 responses

  1. Hi,
    I’m still struggling with my AS2 projects.. and that lack of documentation (just like you said) is quite a problem, would you be kind enough to share a base structure for an AS3 project I just don’t know where to start from, in AS2 I had that small swf that loads the main bigger one but i get tangled with all those document classes..

  2. Interesting that you and the other commenter feel that the documentation for AS3 is inadequate. Personally, I started using AS3 right when Flex 2 came out. To me, the documentation is lightyears beyond anything Macromedia every released for AS2, and that high quality is part of the reason I was able to pick up the language so quickly. The new class reference format (asdoc) is especially top notch!

  3. I’m curious, what’s problematic about the current AS3 docs?

    I’m looking forward to use AS3 in my upcoming projects. Many essential things have changed from AS2, but at least now they seem to work more naturally, without workarounds like Delegate, etc.

    About OOP, I hope AS3 will debunk the myth that OOP is appropriate for RIAs, but not practical for design or advertisement websites.

  4. Amit: I’m not sure I would have anything useful to share. I do have my AS2 “templates” I use, as well as some conventions. But for AS3 I’m mainly porting things over, and still lacking a bit – ie, i don’t have a template of my own that enables ExpressInstall with SWFObject and SWFAddress optionally and anything like that. All the code I had to do up to this day was either experimental/local (no loading) or plain direct porting (Tweener), so I don’t have a very robust site template. I haven’t done any commercial AS3 site yet. I’ve been assembling some things I believe will be awesome for my future AS3 development, but they’re still just experimental.

    All I can say is that I do now is have an index/loader document (index.fla) with a class ( and the loaded document (main.fla) with a class ( that does the basic website funcionality. Which, funny enough, is a depart on how I did things on most of my AS2 projects (where I used single fla files). I assumed it’d just be easier to load the second SWF instead of having to do tricks to manage attachable movieclips, sounds and class loading on different frames.

    Josh, Omine: my biggest problem was with migration. The documentation exists, but some things are barely mentioned and leave a lot to be desired, on my experience.

    When porting my knowledge, I’ve been mainly using the migration table:

    And then the livedocs:

    To cite a few examples. Once I wanted to port some of my code that created sounds on AS2 to AS3. The attachSound() method is removed, and the solution supplied by the migration table is “Create an instance of a Sound subclass that is associated with sound data; for example, by using new Sound() instead”.

    The problem is that it’s a no-solution; it only makes sense if you already know the answer, otherwise it’s just a puzzle. You visit the online documentation for Sound() and it doesn’t mention how to attach a sound from the library. I tried a lot of different things with no luck; I had to search the web for a solution. Luckily, I found similar complains on the flashcoders archive, and the solution was there. It turns out the new method – instantiating from the new sound subclass directly – is much better, but i had to go out of the official documentation to find it because the existing documentation was cryptic at best.

    Other example that just happened a couple of days ago with me is that I needed to use attachBitmap() to add a new bitmap to the stage. Of course that method was removed, so I visited the migration page to see the solution, and it says “In ActionScript 3.0, use addChild() to add child display objects”. Gee, obvious enough, but then I use addChild(bitmapData) and just got a weird error. Looking at it now, the documentation for BitmapData does provide an example that does it (using a new Bitmap() instance), but the example is so convoluted I searched somewhere else before parsing through it first; so again, I found the answer somewhere else. In that case, smaller, more straightforward examples would be better.

    All in all, I have nothing against the new version of the language. I like it a lot; both changes I mentioned are for the better and the API is a lot more natural. I wouldn’t recommend anyone taking AS2 over AS3 now. But I do feel the documentation misses a lot, specially when migrating. These were just two examples, but there are too many answers that are left unanswered or that keep me dumbfounded, and the reason why I think a guidance from scratch (with a book like Moock’s EAS3) is a better option. And I’m usually the guy that hates any kind of guidance and just assume that documentation is more than what anyone should need.

    So I use online and local (CS3) docs when searching for the answers, and when that fail, google. However, it was too often that I found the answer lying somewhere else than Adobe’s own material, even for simple stuff like the sound attaching.

    The asdoc-ish format is great. My personal frustration is with how much the content lacks from a ‘migrator’ point of view, not with the form it has.

  5. having thoroughly enjoyed the Moock’s EA2, I expected this book to cover a bit more of the new toys found in AS3. It seems to lack quite a bit.

    I definitely recommend picking up the Cookbook, and Design Patterns to round out AS3 subject matter. If I remember correctly Moock’s EA3 didn’t even touch RegExp, remoting, and something else I was looking for at the time.

    Oh well, it’s still a must-have, and we’ll never quite be weaned of the Flash Help Menu entirely = ]

Comments are closed.