User Guide
522 Chapter 2: ActionScript Language Reference
MovieClip.getInstanceAtDepth()
Availability
Flash Player 7.
Usage
my_mc.getInstanceAtDepth(depth:Number) : MovieClip
Parameters
depth
An integer that specifies the depth level to query.
Returns
A reference to the MovieClip instance located at the specified depth, or undefined if there is no
movie clip at that depth.
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. 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 displays the depth occupied by the logo_mc movie clip instance in the
Output panel:
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()