Bitmap Smoothing and PixelSnapping

I do a lot of things with Bitmap‘s, especially reusing a single Bitmap object and updating its bitmapData. I was in the middle of some UI work and was baffled to why some of my Bitmap‘s were smooth and some were not after setting smoothing to true. I noticed that if you change the bitmapData property, the Bitmap will lose its smoothing and pixelSnapping values for no reason! Fortunately there’s an obvious fix:

var smoothing:Boolean = bitmap.smoothing;
var pixelSnapping:String = bitmap.pixelSnapping;

bitmap.bitmapData = bitmapData;
bitmap.smoothing = smoothing;
bitmap.pixelSnapping = pixelSnapping;

Hopefully someone updates the API to reflect this little gotcha.

This entry was posted in Gotchas. Bookmark the permalink.

2 Responses to Bitmap Smoothing and PixelSnapping

  1. Dave Burgess says:

    Perhaps you should lodge a bug report?
    Also: Hello! Amazing what you find when data mining.

  2. iopred says:

    There’s a report for it, but this still affects all the poor people with Flash 9 :(

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>