Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Task: Fading Movie Clip

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:

  4. 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.

  • + Share This
  • 🔖 Save To Your Account