Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use transparent BitmapData as a mask

I have a BitmapData object created dynamically that contains user-drawn shapes. I then attach that BitmapData object to a MovieClip via a Bitmap object and set that MovieClip as a mask to another MovieClip. The mask works but the whole bounding rectangle of the BitmapData is acting as the mask. But I want to exclude the transparent portion from the mask so only user-drawn shape can be set as mask. Can anyone tell how to achieve that? Thanks.

like image 489
Kayes Avatar asked Sep 15 '10 08:09

Kayes


2 Answers

I see you already solved it (in the comments section). Posting it as an answer.
Set BOTH movieclip and mask cacheAsBitmap to true.

i.e.:

movieclip.cacheAsBitmap = true;  
movieclip_mask.cacheAsBitmap = true;
like image 98
eLouai Avatar answered Oct 14 '22 23:10

eLouai


The thing you need to do is turn the bitmap caching on.

myMc.cacheAsBitmap = true; if I remember correctly ...

like image 37
Daniel Avatar answered Oct 14 '22 22:10

Daniel