Flash Lite 2.x and 3.0 ActionScript Language Reference

getDepth (MovieClip.getDepth method)

public getDepth() : Number

Returns the depth of the movie clip instance.

Each movie clip, button, and text field has a unique depth associated with it that determines how the object appears in front of or in back of other objects. Objects with higher depths appear in front.

You can extend the methods and event handlers of the MovieClip class by creating a subclass.

Returns

Number - The depth of the movie clip.

Example

The following code traces the depth of all movie clip instances on the Stage:

for (var i in this) {
    if (typeof (this[i]) == "movieclip") {
    trace("movie clip '"+this[i]._name+"' is at depth "+this[i].getDepth());
    }
}

See also

getInstanceAtDepth (MovieClip.getInstanceAtDepth method), getNextHighestDepth (MovieClip.getNextHighestDepth method), swapDepths (MovieClip.swapDepths method), getDepth (TextField.getDepth method), getDepth (Button.getDepth method)