TextArea.length

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

textAreaInstance.length

Description

Property (read-only); indicates the number of characters in a text area. This property returns the same value as the ActionScript text.length property, but is faster. A character such as tab ("\t") counts as one character. The default value is 0.

Example

The following example accesses the length property to display the number of characters that the user types in the TextArea called my_ta.

You must first add an instance of the TextArea component to the Stage and name it my_ta; then add the following code to Frame 1.

/**
 Requires:
  - TextArea instance on Stage (instance name: my_ta)
*/

var my_ta:mx.controls.TextArea;

// Define a listener object.
var taListener:Object = new Object();
taListener.change = function(evt_obj:Object) {
 trace("my_ta.length is now: " + my_ta.length + " characters");
};
my_ta.addEventListener("change", taListener);