Flash image masking effects

April 6, 2010

Animations

Step 1

  • Import an image you want to use.
  • Convert the image into a movie clip (name it whatever you want).
  • Give it an instance name of “imageMC”.

Step 2

(ActionScript code)

  • Create an new actions layer and type the following:
//(This container contains all the mask graphics)
var container:Sprite = new Sprite();

addChild (container);

//(Set the container to be the images mask)
imageMC.mask = container;

//(Set the starting point)
container.graphics.moveTo (mouseX, mouseY);

addEventListener (Event.ENTER_FRAME, enterFrameHandler);

/*Draw a new rectangle in each frame and add it onto the container
(NOTE: you can use all kinds of shapes, not just rectangles) */
function enterFrameHandler (e:Event):void {
	container.graphics.beginFill(0xff00ff);
	container.graphics.drawRect(mouseX-50, mouseY-50, 100, 100);
	container.graphics.endFill();
}

Mouse.hide();

, , ,

Subscribe

Subscribe to our e-mail newsletter to receive updates.

One Response to “Flash image masking effects”

  1. hiru Says:

    wow this is a nice web site

Leave a Reply