AS3 Mask

A simple AS3 Mask in one line!
To make a mask, it is really simple. Create two layers, one is your photo or image, and one is your mask. Name them appropriately, and then add this line of script in. Make sure your mask is on top of your photo and it should be done!

 my_mc.mask = my_mask; 

Mask with soft/blur/feathered edges
Here is the script for another example in which you might have applied a blur filter to your mask and you want your image to be masked with that same blurry edge. If you do not force flash to "cacheAsBitmap" then this blur filter will not be visible.

 stage.addEventListener(Event.ENTER_FRAME, resizeHandler); function resizeHandler(evt:Event):void {	my_mask.x = mouseX; my_mask.y = mouseY; }

my_mc.cacheAsBitmap = true; my_mask.cacheAsBitmap = true;

my_mc.mask = my_mask; 