A Few Things You May Not Know About CacheAsBitmap

cacheAsBitmap is a feature in Flash (since Flash 8) that tells the Flash Player to store a movieclip of vectors into one static instance in memory. It’s a great way to boost the performance of your Flash.

But I’m writing about how to use cacheAsBitmap (you can just google that).

Some things you may never knew about cacheAsBitmap.

  • With the exception of changing position, if a movieclip animates with cacheAsBitmap set to true, performance will slow down. This is because the Flash Player must recalculate the vectors and reload the Bitmap instance into memory. Moving x or y doesn’t change the vectors of the movieclip and thus will not affect performance.
  • cacheAsBitmap is automatically set to true whenever a filter is set on a movieclip.
  • A movieclip moving with cacheAsBitmap set to true, the movieclip will probably not animate smoothly. Unless the displacement values are round numbers, the movieclip will seem to move in a zig zag.


clip.cacheAsBitmap = true;
clip.onEnterFrame = function() {
this._x += 1;
this._y += 1;

Will look fine…

clip.cacheAsBitmap = true;
clip.onEnterFrame = function() {
this._x += 1.5; // Decimal displacement makes things shaky
this._y += 1.5;

Just take a look at the following example… Is the red dot shaking or is it just me? Maybe it’s scared of the blue dot.

Leave a Reply

Your email address will not be published.