AS2

Running AS2 Content in AS3: Beware!

It is perfectly possible to run an AS2 movie within an AS3 Flash application.

However, my advice would be - don't.

Here are a handful of the problems we've encountered when running any AS2 movie of any complexity within AS3:

Smoothing loaded bitmaps in AS2

In Actionscript 2, there is a niggling annoyance with scaling bitmaps images (i.e. JPEG, PNG or GIF images). If such an image is in your Flash movie's library, you can tick the "Allow Smoothing" option; this means that when the image is scaled (up or down) the Flash player does its best to eliminate the jagged, "bitty" look of the resized image - the results are normally pretty good.

However, if you're loading in an image directly - for example, using MovieClipLoader - there is no way to turn on smoothing for that image.

Casting to an Array in AS2

This was originally posted on my blog in May 2007.

An old problem that came back to haunt me today.

Essentially, in AS2 this doesn't work:

var a:Array=[1,2,3];  // Create an array
var b:Object=a; // Works fine, Array is a subclass of Object
var c:Array=b; // Throws a compile error - completely expected, 
               // because the compiler doesn't know that b is an Array
var d:Array=Array(b); // Compiles fine, but gives the wrong answer!

Syndicate content