views:

52

answers:

2

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.

A: 

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.

PatrickS
Tried setting the Bitmap directly as the mask. No luck!
Kayes
Have you tried playing with BlendMode ( forgetting about the mask I mean )?
PatrickS
Well, I've done it! We must set the 'cacheAsBitmap' property of both the Bitmap (that will act as the mask) and the MovieClip (on which the mask will be set) to 'true'. Otherwise the mask won't work properly.
Kayes
Thanks to this post: http://blog.mattiasnorell.com/2010/04/16/dynamic-as3-mask-using-bitmapdata/
Kayes
well done, thanks for the info!
PatrickS
Thanks mate for keeping in touch with me :)
Kayes
A: 

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

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

Daniel
oops sorry, just noticed you figured it out already
Daniel