
TextField.length Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
848
|
ActionScript Language Reference
See Also
getURL(), TextField.embedFonts, TextField.html, TextField.text, the TextFormat class;
Appendix E
TextField.length Property
the number of characters in the text field
Flash 5; object-oriented version introduced in Flash 6
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
TextField.maxChars Property
limits the allowed length of user input
Flash 6; accessible only via authoring tool in Flash 5
read/write
theField.maxChars
Description
Used ...