Gradient Masks in Flash

October 23rd, 2007 . by polyGeek

To create a gradient mask in Flash apply bitmap caching to each of the mask and maskee MovieClips and then use setMask() to apply the mask. As such:maskMC.cacheAsBitmap = true;
img.cacheAsBitmap = true;
img.setMask( maskMC );

Here’s an example:

Download FLA

WhatDoIKnow.org has a nice writeup with comments on the topic. By the way, you can do this same effect without code but it seems like a lot more work to me.

I only need to do this about once a year and I always end up spending an hour going, “how the frak did I do that last year.” Now next year when I need to do this again I can just search my own blog. If I remember that I wrote about this. :-)

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Digg
  • Facebook

2 Responses to “Gradient Masks in Flash”

  1. comment number 1 by: Bjørn

    Nice one, Dan :-)


  2. very easy to create a gradient alpha mask using code. But sometimes you have to do it the gold old fashioned …

Leave a Reply

Name

Mail (never published)

Website

- Why ask? This confirms you are a human user!

   




© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites