Newsletter: Learn More ||| Multimedia Presentation Software |||
Dynamic Masking in Flash MX
Introduction
With Flash MX you can mask objects dynamically using ActionScript. In this small tutorial I will show you how to use the setMask method to mask a object.rn .
Contents Download the file.
Step One
Create a new movie.
Step Two

Import two images into flash.

Step Three
Convert the images to movieclips.
Step Four

Give both the movieclips instance names, "angel" and "horse".

Step Five
Create the masking object. In this case, it is a small circular object.
Step Six
Convert the circular object into a movie clip. Give it an instance name of "masker".
Step Seven
Create three buttons.
Step Eight
Before I give actionscript to the buttons I give them Instance names. Here they are named "left", remove" and "right".
Step Nine
Select the first frame of the current layer, press f9 to open the actions window and enter the following actions:

right.onPress = function() {
angel.setMask(null);
horse.setMask(masker);
};

left.onPress = function() {
horse.setMask(null);
angel.setMask(masker);
};

remove.onPress = function() {
horse.setMask(null);
angel.setMask(null);
};

masker.onEnterFrame = function() {
this._x = _xmouse;
this._y = _ymouse;
};

Step Ten
Test the movie.
This article was first published by www.internetcross.com.
 
©2007 Wildform, Inc | Policies | Contact Us | Newsletter Options
 
Wildform provides a 100% satisfaction guarantee on all our software. If you are not completely satisfied with our software for any reason you may request a refund within 15 days of purchase.