Flash Masking Animation with ActionScript 3 (2)
This Flash masking with ActionScript is similar to the previous tutorial. In this tutorial, the masking can be move around with mouse pointer to create more interesting effect.
Actually the masking can be applied at runtime with Flash ActionScript 3. This example shows how to use simple AS3 to accomplish the result.
Flash Masking Tutorial Content
The flash masking animation effect is shown as above. Move the mouse pointer above the flash movie to see the effect.
The technique is exactly the same as the previous tutorial. The layers and objects are created and converted to symbol as usual. Then apply masking effect at runtime with Flash ActionScript.

Flash ActionScript Codes:
// Use cacheAsBitmap to convert mcMask and mcBG to bitmap at runtime
// Set cacheAsBitmap of both mcMask and mcBG to true
// to get the transparency effect
mcMask.cacheAsBitmap = true;
mcBG.cacheAsBitmap = true;
// Apply Mask
mcBG.mask = mcMask;
// Hook a function to mcMask
mcMask.addEventListener(Event.ENTER_FRAME, movingMask);
function movingMask(evt:Event):void
{
mcMask.x = mouseX;
mcMask.y = mouseY;
}
Download Flash Source File:
Remarks:
This Flash Animation tutorial shows how to create a mask layer at runtime with Flash ActionScript 3.