Creating a mask that follows a motion guide

Note: The information in this TechNote is specific to Macromedia Flash 5 and earlier. Macromedia Flash MX adds the ability to use animated or scripted movie clips as masks. The techniques in this technote will continue to work in Macromedia Flash MX, however it would be simpler to use the new features of Macromedia Flash MX. For complete details refer to the Macromedia Flash MX documentation.

Motion Tweening Masks in Flash 5 and earlier versions

Many interesting effects can be created using masks together with motion tweens. This is a great way to get an animated mask. Some users want the tweened mask to follow a motion guide. But since a layer can't be both a mask layer and a guide layer, this is not possible using a single SWF.

However, this effect can be achieved using two Flash movies. In one movie, a motion tween is created that follows a guide layer. This movie is then exported as an SWF and imported into the second movie. In the second movie, the layer that contains the imported SWF is set to be a mask layer. Finally, the object to be masked is placed in a masked layer under the imported tween.

Prerequisites: This tutorial assumes that you are familiar with the basic concepts of masks, as discussed in Creating masks and creating motion guides, as covered in How to add and use a motion guide (TechNote 14133).

Download the source files for this example (17K)

To have a mask follow a motion guide do the following:

  1. In the first movie, create a motion tween that follows a guide layer. This animation will be used as the mask in the second movie. The shape of the tweened object needs to be the shape that you want the mask to be.
  2. Publish, or export, the first movie as an SWF.
  3. Import the SWF exported above into another Flash movie using the File > Import command. This will bring in the SWF as a frame by frame animation on one layer, which will be used as the mask layer.
  4. Change the imported layer's property to Mask and add the material that you want masked to a layer below the mask layer.

Additional Information

If your motion tween does not follow the guide layers see, Motion path animation doesn't follow path (TechNote 4104). If you encounter problems with using a movie clip in the mask layer see Problems using movie clips in mask layers (TechNote 14264).

Keywords: tn_15781

Adobe logo

Sign in to your account