Using a timeline animation as alpha mask
March 15th, 2009 • ActionScript
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; } ...
One Response (Add Your Comment)
Trackbacks:
-
Pages tagged “animation” — March 21, 2009 at 2:35 pm