View comments | RSS feed

MovieClip.getDepth()

Availability

Flash Player 6.

Usage

my_mc.getDepth() : Number

Parameters

None.

Returns

An integer.

Description

Method; returns the depth of a movie clip instance. 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 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

MovieClip.getInstanceAtDepth(), MovieClip.getNextHighestDepth(), MovieClip.swapDepths()

Comments


6ixX said on Aug 5, 2004 at 5:38 AM :
one i noticed at elements at design time have a depth of --16383 and _level0 or _root seems to have one depth lower. i'm currently using MX2004 pro 7.2 update.
No screen name said on Apr 12, 2005 at 6:37 PM :
i also get strange depth values and am currently using flash mx 2004 pro 7.2
No screen name said on Apr 12, 2005 at 6:39 PM :
this bug happens when i have movieclips within movieclips and i try to get a depth value on the inner mc's
Francis Cheng said on Apr 21, 2005 at 8:44 AM :
The depth value -16383 is the expected depth value for a movie clip created at design time (in the authoring tool). Items created at design time are placed at depths starting at -16383.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001505.html