Win 80% performance on Flash ActionScript 2 project

If you have lot of AS 2.0 projets like me you should be happy to know that you could win 80% performance on your projets with 4 lines of ActionScript.

First compile your AS 2.0 project with Flash.

Export your swf file in AS 2.0. (eg: your_as2_project.swf)

Then create an AS 3.0 loader with Flash CS3 or better.

Keep the same framerate on your loader. The same dimentions and the same background color. Put those lines into your AS 3.0 loader and replace the swf file with your file name.

var request:URLRequest = new URLRequest("your_as2_project.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);

Finally compile your AS 3 loader.

It’s magic it works perfectly. It’s more smoothly and faster. Thanks AVM2 ;).

Very important notes :

  • Delete all your TextField variables on you AS 2.0 file and use instance name. In AS 3.0 AVM2 doesn’t support TextField variables.
  • You couldn’t send HTML parameters to swf direclty to your AS 2.0 swf. You have to use a LocalConnection in order to send and receive informations between your 2 swf.