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 exclud开发者_运维技巧e the transparent portion from the mask so only user-drawn shape can be set as mask. Can anyone tell how to achieve that? Thanks.
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;
The thing you need to do is turn the bitmap caching on.
myMc.cacheAsBitmap = true;
if I remember correctly ...
Maybe you should try using the Bitmap itself as a mask , if you need that Bitmap to show, try creating another Bitmap using the transparent BitmapData and use that as a mask.
精彩评论