advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the Source Code for this Article
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 4.7/5 | Rate this item | 3 users have rated this item.
Email this articleEmail this article
 
Use Alpha Gradient Masks in Flash 8, At Last!
Finally! The newly released Flash 8 includes one feature that designers have wanted for years—the ability to use an alpha gradient as a mask. 

advertisement
n last month's article, I gave you an overview of some of Flash 8's most exciting features. This month, I'll show you how easy it is to achieve a long-desired effect—gradient masks.


Prior versions of Flash supported only 1-bit masks, meaning that only hard-edge masks were possible. In masks, pixels were considered either completely transparent or not transparent at all, with no gradations of opacity. Even if you used an alpha gradient in a mask, all non-transparent pixels would reveal the underlying content. In Flash 8, a new feature called "runtime bitmap caching" has changed all that.

Caching a MovieClip as a bitmap at runtime provides significant performance enhancements for complex MovieClips. It is less of a strain for your CPU to push pixels around the screen than to repeatedly recalculate the vector math and relevant properties (rotation, scale, alpha, etc.) that may be at work in your MovieClips.

 
Figure 1. Hard vs. Alpha Gradient Masks: On the left, you can see a mask created in Flash MX 2004, where only 1-bit masks are supported. On the right, an alpha gradient in Flash 8 has given the same mask a soft edge.
In addition, caching a MovieClip as a bitmap has other fun benefits. It allows a new level of compositing not possible in prior versions of Flash. In future articles, I will introduce you to runtime bitmap filters (drop shadow, glow, etc.), blend modes (akin to Photoshop blend modes or Director ink effects), and the new BitmapData class. The latter provides a variety of image manipulation methods, such as the ability to copy pixels from one image to another.

If you haven't yet tried the new Flash 8 player, the old Flash mask seen in the left half of Figure 1, can become the feathered beauty you see in the right half of Figure 1. Hello soft wipes, and a host of other long-awaited effects! You'll need the new Flash 8 player to view the animations that accompany this article.

A Simple Example
This month, I'm going to show you how these simple lines of script...

   maskee.cacheAsBitmap = true;
   maskMC.cacheAsBitmap = true;

...can change the older Flash 1-bit solid mask shown on the left to the newer alpha gradient mask shown on the right.
Note that if you haven't downloaded and installed the Flash 8 player, both Flash movies shown above will appear identical.

  Next Page: Using Scriptable Masks


Page 1: IntroductionPage 2: Using Scriptable Masks
Untitled
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES