Image Mask Eraser
February 6, 2009 by: smonteThis a very easy and quick tutorial. You’ll learn how to create an image mask eraser.
Setting up the environment
1. Import an image you want to use.
2. Convert the image into a movie clip (name it whatever you want).
3. Give it an instance name of “imageMC”.
Moving to ActionScript
4. Create an 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 image's 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();
5. You are done, test your movie!
Related tutorials:
Comments
2 Responses to “Image Mask Eraser”Leave a Reply
You must be logged in to post a comment.
This helped me out a lot thanks!
Wow! That’s amazing! TOTALLY what i was looking fooor 0_0 thaaaaaaaaanks