Scaling Your Images in Flash Player? Smooth Those Things!!!

I actually forgot to apply the “smoothing” property to a flash.display.Bitmap display object being scaled inside Flash Player. Just look at the difference such an oversight made!

Smoothing

Since I was using a flash.display.Loader display object to load the image up, and Loader has no smoothing property, I totally spaced on this and it’s been out there for months rendering images in a pretty crappy way. I just needed to assign the image data to a Bitmap object and use that for display instead.

private function imageLoaded(e:Event):void {
    var imageBitmap:Bitmap = imageLoader.content as Bitmap;
    imageBitmap.smoothing = true;
    imageDrag.addChild(imageBitmap);
    //scale away!
}

Easy.

Learn from my blunder- always make sure to enable smoothing!

4 thoughts on “Scaling Your Images in Flash Player? Smooth Those Things!!!”

  1. Good post, this seems to be an easy (but important) point to overlook. It’s worth noting that you can actually smooth loaded images in a single line:

    Bitmap(myLoader.content).smoothing = true;

  2. Thanks!! I was doing a scroller for a client which had Loaders embedded in an mc and couldn’t work out why turning the mc’s smoothing on didn’t smooth the images. This worked perfectly :)

  3. Thanks for this tip; should be noted that you can use the loader as-is if you’re already attaching it. Just pull out the bitmap as described and set smoothing and it will affect the existing loader contents — exactly what I needed to do!

Leave a Comment

Your email address will not be published. Required fields are marked *