Flash Lite 2.x and 3.0 ActionScript Language Reference

length (TextField.length property)

public length : Number [read-only]

Indicates the number of characters in a text field. This property returns the same value as text.length, but is faster. A character such as tab (\t) counts as one character.

Example

The following example outputs the number of characters in the date_txt text field, which displays the current date.

var today:Date = new Date();
this.createTextField("date_txt", this.getNextHighestDepth(), 10, 10, 100, 22);
date_txt.autoSize = true;
date_txt.text = today.toString();
trace(date_txt.length);