User Guide
470 ActionScript classes
See also
getInstanceAtDepth (MovieClip.getInstanceAtDepth method),
getNextHighestDepth (MovieClip.getNextHighestDepth method), swapDepths
(MovieClip.swapDepths method)
, getDepth (TextField.getDepth method), getDepth
(Button.getDepth method)
getInstanceAtDepth (MovieClip.getInstanceAtDepth
method)
public getInstanceAtDepth(depth:Number) : MovieClip
Determines 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.
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
depth:Number - An integer that specifies the depth level to query.
Returns
MovieClip - A reference to the MovieClip instance located at the specified depth, or
undefined if there is no movie clip at that depth.
Example
The following example displays the depth occupied by the
triangle movie clip instance in
the Output panel:
this.createEmptyMovieClip("triangle", 1);
triangle.beginFill(0x0000FF, 100);
triangle.moveTo(100, 100);
triangle.lineTo(100, 150);
triangle.lineTo(150, 100);
triangle.lineTo(100, 100);
trace(this.getInstanceAtDepth(1)); // output: _level0.triangle