Internet Cross Logo
Internet Cross your one stop web tutorial website
Your Ad Here

Dynamic Masking in Flash MX

by Anand


With Flash Mx comes dynamic masking. Now you can mask objects using action script. In this small tutorial I will show you how to use the setMask method to mask a object.rn

1.Create a new movie.
2.Import two images into flash.
3.Convert the images to movieclips.
4.Give both the movieclips instance names, I gave "angel" and "horse".
5.Now create the masking object, in this case it is a small circular object.
6.Convert the circular object into a movie clip give it an instance name of "masker".
7.Create three buttons
8.Before I give actionscript to the buttons I give them Instance names. I gave "left", remove" and "right".
9.Select the first frame of the current layer, press f9 to open the actions window and enter the folowing 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;
};

10.Test the movie.


[Download File][Page 1]
Visit our forums to discuss / post your problems.