TextField.getDepth( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
TextField.getDepth( ) Method Flash 6

returns the position of the text field in the content stack
theField.getDepth()

Returns

An integer depth level.

Description

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.

See Also

MovieClip.createTextField( ), MovieClip.getDepth( ), MovieClip.swapDepths( ); "Movie and Instance Stacking Order," in Chapter 13



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net