Table of Contents

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


Table of Contents