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.
The following snippet of code is a workaround for this problem. Call the function BitmapUtils.smoothLoadedImage(clip) on the clip that you loaded the image into, and it'll be smooth when scaled.
/** Image smoothing workaround * By Ian Thomas at Awen, 2006 */ import flash.display.BitmapData; class com.awen.utils.BitmapUtils { /** Workaround for a bug in AS2 whereby it's impossible to add smoothing to * a loaded bitmap (i.e. one that's not in the library). * @param target The loaded bitmap - calling this in onLoadInit would be appropriate. */ public static function smoothLoadedBitmap(target:MovieClip):Void { // Adjust scaling to make sure we're getting as // high res a copy as possible var xs:Number=target._xscale; var ys:Number=target._yscale; target._xscale=100; target._yscale=100; // Copy the loaded bitmap into a new bitmap var bitmap:BitmapData=new BitmapData(target._width,target._height,true,0); bitmap.draw(target); // Paste it over the top of the loaded bitmap - as a child MC. var mc:MovieClip=target.createEmptyMovieClip(target._name+"bmap",target.getNextHighestDepth()); mc.attachBitmap(bitmap,100,"never",true); // The critical parameter is 'true' - this allows smoothing // The next two lines ensure the bitmap data gets disposed when the clip is unloaded. mc.bitmap=bitmap; mc.onUnload=function(){this.bitmap.dispose();} // Reset scaling target._xscale=xs; target._yscale=ys; } }