User Guide

150 Chapter 3: Objects
element.depth
Availability
Flash MX 2004.
Usage
element.depth
Description
Read-only property; an integer that has a value greater than 0 for the depth of the object in the
view. The drawing order of objects on the Stage specifies which one is on top of the others. Object
order can also be managed with the Modify > Arrange menu item.
Example
The following example displays the depth of the specified element in the Output panel:
// select an object then run this script
fl.trace("Depth of selected object: " +
fl.getDocumentDOM().selection[0].depth);
See the example for element.elementType.
element.elementType
Availability
Flash MX 2004.
Usage
element.elementType
Description
Read-only property; a string that represents the type of the specified element. The value is one of
the following:
"shape", "text", "instance", or "shapeObj". A "shapeObj" is created with an
extensible tool.
Example
The following example stores the type of the first element in the eType variable:
// In a new file, place a movie clip on first frame top layer,
// then run this line of script
var eType =
fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].elementTy
pe; //eType = instance
The following example displays several properties for all the elements in the current layer or
frame:
var tl = fl.getDocumentDOM().getTimeline()
var elts = tl.layers[tl.currentLayer].frames[tl.currentFrame].elements;
for (var x = 0; x < elts.length; x++) {