M > MovieClip.setMask

 

MovieClip.setMask

Availability

Flash Player 6.

Usage

myMovieClip.setMask (maskMovieClip)

Parameters

myMovieClip The instance name of a movie clip to be masked.

maskMovieClip The instance name of a movie clip to be a mask.

Returns

Nothing.

Description

Method; makes the movie clip in the parameter maskMovieClip into a mask that reveals the movie clip specified by the myMovieClip parameter.

The setMask method allows multiple-frame movie clips with complex, multilayered content to act as masks. You can shut masks on and off at runtime. However, you can't use the same mask for multiple maskees (which is possible by using mask layers). If you have device fonts in a masked movie clip, they are drawn but not masked. You can't set a movie clip to be its own mask, for example mc.setMask(mc).

If you create a mask layer that contains a movie clip, and then apply the setMask method to it, the setMask call takes priority and this is not reversible. For example, you could have a movie clip in a mask layer called UIMask that masks another layer containing another movie clip called UIMaskee. If, as the movie plays, you call UIMask.setMask(UIMaskee), from that point on, UIMask is masked by UIMaskee.

To cancel a mask created with ActionScript, pass the value null to the setMask method. The following code cancels the mask without affecting the mask layer in the Timeline.

UIMask.setMask(null)

Example

The following sample code uses the movie clip circleMask to mask the movie clip theMaskee.

theMaskee.setMask(circleMask);