866
ActionScript classes
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 Player 7
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
See also
attachMovie (MovieClip.attachMovie method)
,
duplicateMovieClip
(MovieClip.duplicateMovieClip method)
,
createEmptyMovieClip
(MovieClip.createEmptyMovieClip method)
,
getDepth (MovieClip.getDepth
method)
,
getNextHighestDepth (MovieClip.getNextHighestDepth method)
,
swapDepths (MovieClip.swapDepths method)
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...