Posts Tagged ‘Add new tag’
Using a timeline animation as alpha mask
March 15th, 2009 • 1 comment ActionScript
Tags: ActionScript, Add new tag, AS3, Flash
I guess you know, that you have to set the cacheAsBitmap property of both, the mask and the masked Sprite, to apply an alpha mask.
... mask.cacheAsBitmap = true; container.mask = mask; container.cacheAsBitmap = true; ...
This works perfectly with a static bitmap mask but if you try to do the same with an animated MovieClip mask, the mask will not work anymore. Apparently the cacheAsBitmap property of the MovieClip is reset on entering a new frame and therefore to get it working you have to set cacheAsBitmap = true in every frame.
... mask.cacheAsBitmap = true; container.mask = mask; container.cacheAsBitmap = true; addEventListener(Event.ENTER_FRAME, frameHandler); function frameHandler(event : Event) : void { mask.cacheAsBitmap = true; } ...


