TextField.getDepth( ) Method | Flash 6 |
returns the position of the text field in the content stack |
An integer depth level.
Text fields, movie clips, and buttons are all placed in the Player in an order that governs how objects stack visually. An internal depth property indicates each object's order in the content stack. The getDepth( ) method tells us a field's integer depth position. Each depth level can have only one occupant, whether the occupant is a text field, button, or movie clip. Objects on higher depths appear in front of those with lower depths. For text fields created at runtime with MovieClip.createTextField( ), the return value of getDepth( ) is the depth assigned to the method's depth parameter. For example:
// Sets depth to 13 this.createTextField("theField_txt", 13, 0, 0, 150, 20); trace(theField_txt.getDepth()); // Displays: 13
For text fields created manually at authoring time, getDepth( ) returns a depth in the range of -16383 to -1 (inclusive). Unlike the MovieClip class, TextField has no swapDepths( ) method, so each text field's depth is fixed once it has been assigned.
For much more information about depths, see Section 13.4 in Chapter 13.
MovieClip.createTextField( ), MovieClip.getDepth( ), MovieClip.swapDepths( ); "Movie and Instance Stacking Order," in Chapter 13