Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

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.

Please update flash player to view this Flash ActionScript tutorial!

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 masking animation

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:

Flash Source File 08-simple-mask.fla


This Flash Animation tutorial shows how to create a mask layer at runtime with Flash ActionScript 3.