Drawing a BitmapData Object from a Masked Source

I recently stumbled upon a really nice trick while using the BitmapData object. The problem occurs when attempting to use the draw() method on a MovieClip instance source that had a mask applied via setMask(). Either nothing would be drawn, or the content would be drawn incorrectly. I’ve found that setting the cacheAsBitmap property to ‘true’ for both the source content and the mask itself will get around this issue.

leftContent.cacheAsBitmap = true;
leftMask.cacheAsBitmap = true;

Leave a Reply

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