Flash/Flex Tidbit #2 How to use Alpha Mask in Flash CS3

Oct
21

So the other day I spent 2hrs looking for how to and trying to do an alpha mask (I’ve done on once). So like an idiot I was trying to do it the Photoshop way with level of gray.

My method of thinking

  • Black = 100 and White = 0
  • but it doesn’t matter what color only the opacity.

If you have never mad a alpha mask in Flash before or CS3 it’s easy.

  1. open a fla
  2. draw a shape
  3. Make that shape a MovieClip
  4. name it maskee_mc
  5. draw a second shape
  6. use a linear gradient
  7. choose color
  8. set one linear color alpha at say, 40
  9. Make that second shape another MovieCilp
  10. name it mask_mc

[as]

this.mask_mc.cacheAsBitmap = true;
this.maskee_mc.cacheAsBitmap = true;
// as2 was maskee_mc.mask(mask_mc);
maskee_mc.mask = mask_mc;

[/as]
That’s it!

 

6 Responses to “Flash/Flex Tidbit #2 How to use Alpha Mask in Flash CS3”

  1. pallzoltan says:

    hello!

    do you think you could provide a sample fla for this? i cant get it working…

    ps: as 2 was setMask(), not mask() ;)

    cheers,
    Z.

  2. joshspoon says:

    Yeah give me a sec. I’ll throw it up there

  3. pallzoltan says:

    thanks mate

  4. marty says:

    Sweet. Can’t believe how simple this was, after looking through so many other complicated solutions.
    Thanks

  5. den says:

    Thanks Josh, I’ve just found this very useful!

Leave a Reply