User Guide
MovieClip.getNextHighestDepth() 579
Description
Method; lets you determine if a particular depth is already occupied by a movie clip. You can use
this method before using
MovieClip.attachMovie(), MovieClip.duplicateMovieClip(), or
MovieClip.createEmptyMovieClip() to determine if the depth parameter you want to pass to
any of these methods already contains a movie clip.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Example
The following example writes the depth occupied by the logo_mc movie clip instance to the log
file:
this.createEmptyMovieClip("logo_mc", 1);
logo_mc.loadMovie("http://www.macromedia.com/devnet/mx/blueprint/articles/
nielsen/spotlight_jnielsen.jpg");
trace(this.getInstanceAtDepth(1)); // output: _level0.logo_mc
See also
MovieClip.getDepth(), MovieClip.getNextHighestDepth(), MovieClip.swapDepths()
MovieClip.getNextHighestDepth()
Availability
Flash Player 7.
Usage
my_mc.getNextHighestDepth() : Number
Parameters
None.
Returns
An integer that reflects the next available depth index that would render above all other objects on
the same level and layer within
my_mc.
Description
Method; lets you determine a depth value that you can pass to MovieClip.attachMovie(),
MovieClip.duplicateMovieClip(), or MovieClip.createEmptyMovieClip() to ensure that
Flash renders the movie clip in front of all other objects on the same level and layer in the current
movie clip. The value returned is 0 or higher (that is, negative numbers are not returned).
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Example
The following example creates a new movie clip instance, logo_mc, at the next highest depth
available. At runtime,
logo_mc renders in front of all other instances at the same level.
this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
var logo_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();