Alpha channel masking in flash

If you want to use a mask that isn't a regular "on/off" mask (for example you want to use a gradient as a mask) here's how you do it in flash:

You have to set both the mask and the thing you're masking to use bitmap caching. You also need to set the mask with code (not using a mask layer in the IDE).

So some example code would be:

sprite1.cacheAsBitmap = true;
sprite2.cacheAsBitmap = true;
sprite1.setMask(sprite2)

Note: this requires version 8. Also note, this picture actually has no relevance to this topic, I just thought it was cool.

Currently rated 2.0 by 4 people

  • Currently 2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Comments are closed