Movieclip.swapdepths() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

MovieClip.swapDepths()

Availability
Flash Player 5.
Usage
my_mc.swapDepths(depth:Number)
my_mc.swapDepths(target:String)
Parameters
A number specifying the depth level where
depth
A string specifying the movie clip instance whose depth is swapped by the instance
target
specified by
my_mc
Returns
Nothing.
Description
Method; swaps the stacking, or z-order (depth level), of the specified instance (
movie clip specified by the
depth level specified in the
clip. Swapping the depth level of movie clips has the effect of moving one movie clip in front of or
behind the other. If a movie clip is tweening when this method is called, the tweening is stopped.
For more information, see "Managing movie clip depths" in Using ActionScript in Flash.
You can extend the methods and event handlers of the MovieClip class by creating a subclass. For
more information, see "Assigning a class to a movie clip symbol" in Using ActionScript in Flash.
Example
The following example swaps the stacking order of two movie clip instances. Overlap two movie
clip instances on the Stage, called
ActionScript to your AS or FLA file:
myMC1_mc.onRelease = function() {
this.swapDepths(myMC2_mc);
};
myMC2_mc.onRelease = function() {
this.swapDepths(myMC1_mc);
};
See also
_level, MovieClip.getDepth(), MovieClip.getInstanceAtDepth(),
MovieClip.getNextHighestDepth()
582
Chapter 2: ActionScript Language Reference
. Both instances must have the same parent movie clip.
parameter, or with the movie clip that currently occupies the
target
parameter. Both movie clips must have the same parent movie
depth
myMC1_mc
is to be placed.
my_mc
and
and then add the following
myMC2_mc
) with the
my_mc

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents