Seb Lee-Delisle


New improved cacheAsBitmap!

I’ve been working on a smart function that can convert a MovieClip into a bitmap so that it renders faster. “What’s wrong with the cacheAsBitmap property?” I hear you cry. Well much as it’s an amazing way to optimize the speed of moving clips, it can sometimes actually slow down render time!

It’s fine as long as you don’t resize or rotate your MovieClip. But as soon as you change the clip, the FlashPlayer has to re-create the bitmap cache.

So what I’ve done is make a bitmap and rotate and scale that instead. It’s not quite as good quality as when you do it with Vector graphics, but it’s so much faster it doesn’t matter.

And here’s an example:

And yes it is AS2! 🙂

So I spent ages working on this code (matrix hell that you don't want to know about), and I have a horrible feeling someone else beat me to it, so if anyone's seen anything like this before let me know!

And I'll be releasing this under a creative commons licence as soon as I get a spare moment, so keep an eye out :-).

This entry was posted in Actionscript, Flash, Flash Physics. Bookmark the permalink.

3 Responses to New improved cacheAsBitmap!