TextField.length Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
TextField.length Property Flash 6

the number of characters in the text fieldFlash 5; object-oriented version introduced in read-only
theField.length

Description

The integer length property returns the number of characters in theField.text (similar to the String.length property), including whitespace. If theField.htmlText is assigned HTML source, theField.length still returns the number of characters in theField.text (which is the same as htmlText, but stripped of HTML tags). The length property of a text field is a character count, not a width; to access the pixel width of a field, use theField._width. To retrieve the value of a specific character in theField, use theField.text.charAt(n), where n is the zero-relative character to retrieve.

Example

this.createTextField("theField_txt", 1, 0, 0, 200, 20); theField_txt.text = "welcome"; trace(theField_txt.text.length);  // Displays: 7

See Also

String.charAt( ), String.length, TextField.htmlText, TextField.text, TextField._width



    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