Learning ActionScript 2.0 in Adobe Flash |
|
|
|
| Working with Movie Clips > Managing movie clip depths > Determining the depth of an instance | |||
To determine the depth of a movie clip instance, use MovieClip.getDepth().
The following code iterates over all the movie clips on a SWF file's main timeline and shows each clip's instance name and depth value in the Output panel:
for (var item:String in _root) {
var obj:Object = _root[item];
if (obj instanceof MovieClip) {
var objDepth:Number = obj.getDepth();
trace(obj._name + ":" + objDepth)
}
}
For more information, see getDepth (MovieClip.getDepth method) in the ActionScript 2.0 Language Reference.
|
|
|
|