Working with Masks in Flash ActionScript 3.0

his Flash tutorial demonstrates how to create random masks over an image in Flash using ActionScript 3.0 code.

Editor’s review:

Pretty nifty effect, and very easy to add. Would really like some more in-depth explanation of the code, but still a pretty good tutorial. Unfortunately, when I first tried to execute, I got a few errors (which is why I would have liked better explanation of the code). Using the “Output” window in Flash helped me troubleshoot, but for beginners, they might find this tutorial a little confusing.

Here are the 2 errors/changes I made for it to work:

//Create the mask which follows cursor movement (master mask)
var masterMask:MyMask=new MyMask(1);

In the second line of the code above, I simply removed the “1″ to read:

var masterMask:MyMask=new MyMask();

The other error was in this code:

//Create a new mask with random scale
var newMask:MyMask=new MyMask(scale);

Again, I simply removed the “scale” from between the parentheses to read:

var newMask:MyMask=new MyMask();

That did the the trick for me. Again, with more explanation, it would be easier to for a beginner to edit. Still, a great little effect, and if you know what to look for in the error output window, a pretty easy to implement Flash tutorial.

View Tutorial: Flash Tutorial: Random Mask Effect in  ActionScript 3.0

Additional Info
Version: CS3 and above
ActionScript: 3.0
Online example: Yes
Source files available: No
Video Tutorial: No


About this entry