Introducing the as3for2 framework (an AS3 emulation layer in AS2)

Is ActionScript 2 still used?

We rarely have ActionScript 2 based projects these days at Dreamsocket, but a few still pop up now and again. Most of the time when they do it is because the project had some limitation that required it to be ActionScript 2. Recently we had two projects that had this type of limitation. One was using ScaleForm, a C++ Flash implementation which is typically used to create UIs for games (on platforms like the PS3, XBOX, etc). In our case we were creating a UI for a set top box platform. The other was for a random banner ad that needed to play nice in foreign environments. In both cases we turned to our as3for2 framework.

What is as3for2?

The moment ActionScript 3 came out, it was clear the new language was much simpler and cleaner to work with. Having a lot of large ActionScript 2 projects at the time that we wanted to port, we created a framework that wrapped ActionScript 2 to emulate the new ActionScript 3 objects and interfaces. It enabled us to slowly port chunks of code over to the point we just had to change a few syntax points and the code was now running atop ActionScript 3. That definitely was helpful but it was more of a short term transitional usage of the framework. Where it has been invaluable are projects like the ones mentioned above where we have to step back in time because of limitations that won’t allow us to use ActionScript 3. The sad thing is we’ve sat on this code base for about 5 years without sharing it. I guess it is better late than never. So today we are releasing the framework under an MIT license for anyone who still has to dabble in ActionScript 2.

What is in the framework?

– AS3 style event framework with bubbling, priorities, scoping, phases, formal events
– display package with DisplayObject, Graphics, Sprite, Stage, etc that hold the same AS3 APIs
– NetStream, NetConnection, SoundTransform
– Timer

Where do I get it?

All the code is up on So go grab it now! It may be something useful on a project, fun for a stroll down memory lane, or educational as you port things over to JavaScript.

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">