Flash Player 5.
my_mc.swapDepths(depth:Number)my_mc.swapDepths(target:String)
depth A number specifying the depth level where my_mc is to be placed.
target A string specifying the movie clip instance whose depth is swapped by the instance specified by my_mc. Both instances must have the same parent movie clip.
Nothing.
Method; swaps the stacking, or z-order (depth level), of the specified instance (my_mc) with the movie clip specified by the target parameter, or with the movie clip that currently occupies the depth level specified in the depth parameter. Both movie clips must have the same parent movie 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.
The following example swaps the stacking order of two movie clip instances. Overlap two movie clip instances on the Stage, called myMC1_mc and myMC2_mc and then add the following ActionScript to your AS or FLA file:
myMC1_mc.onRelease = function() {
this.swapDepths(myMC2_mc);
};
myMC2_mc.onRelease = function() {
this.swapDepths(myMC1_mc);
};
_level, MovieClip.getDepth(),MovieClip.getInstanceAtDepth(), MovieClip.getNextHighestDepth()
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001556.html
Comments
Firetron said on Oct 27, 2004 at 1:43 PM : No screen name said on Aug 29, 2005 at 2:48 PM : No screen name said on Aug 29, 2005 at 2:50 PM :