Task: Fading Movie Clip

I l @ ve RuBoard

If you can set a movie clip's transparency value, it follows that you can gradually change that value to make it appear as if the movie clip is fading away. Here's how to do it:

  1. Start with a new Flash movie.

  2. Create a simple movie clip. Any simple shape will do.

  3. Attach the following movie clip script:

     onClipEvent(enterFrame) {     if (this._alpha > 0) {         this._alpha -= 5;     } } 

This script uses an if statement to determine whether the _alpha value is not yet at 0. It starts at 100 and then decreases by 5 area frames . If it is 0, it fails the if statement, and the _alpha property no longer decreases.

The example movie 07fadeaway.fla contains this script. Give it a try.

I l @ ve RuBoard


Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net