MovieClip.setMask()

Availability

Flash Player 6.

Usage

my_mc.setMask(mask_mc)

Parameters

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

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

Returns

Nothing.

Description

Method; makes the movie clip in the parameter mask_mc a mask that reveals the movie clip specified by the my_mc parameter.

This 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 masks (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, my_mc.setMask(my_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 SWF file 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 code uses the movie clip circleMask_mc to mask the movie clip theMaskee_mc.

theMaskee_mc.setMask(circleMask_mc);