Wednesday, 8 October 2008

Draggable dynamic masking

This Flash tutorial will teach you how to create draggable dynamic mask. This is similar to the previous dynamic masking tutorial, but this time the mask is draggable. This means you are able to drag your mouse to reveal the layer below, instead of mousing over your masked layer.

This is a continuation of the dynamic masking tutorial. And this will be an alternative for step 5. The previous steps will be the same, but this time I have used an image instead of text for the masked layer.

Draggable dynamic masking

Step 5

On the timeline insert a new layer called “actions”. Right click on the first frame and select actions and enter the following code:

mask_mc.onPress = function () {
startDrag(this);
}
mask_mc.onRelease = function () {
stopDrag();
}
maskedbg_mc.setMask(mask_mc);

**The startDrag(this) makes the mask draggable, so allows the user to drag the mask around. The “(this)” refers to “mask_mc” the object which is draggable. You alternatively put “mask_mc” in the parenthesis if you wish. And the stopDrag() basically stop dragging the object.


Step 6

Test the movie clip ctrl + enter. And drag the mouse to reveal the mask below.



You should have a draggable mask.

3 comments:

roentarre 12 October 2008 at 03:50  

Very cool

Do you design flash for clients?

iliketo 12 October 2008 at 08:42  

@roentarre

Maybe depends on the scale of the project.

Chris 12 October 2008 at 16:36  

Hey thanks for the post. Found it very useful as im doin this stuff at uni atm.

  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP