User Guide
TextInput.length 1225
TextInput.length
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
textInputInstance.length
Description
Read-only property; a number that indicates the number of characters in a TextInput
component. A character such as tab (
"\t") counts as one character. The default value is 0.
Example
The following example creates a listener for the change event on the TextInput instance
my_ti. The listener accesses the length property to display the length of the text in my_ti as
the user enters text.
You must first drag a TextInput component to the Stage and give it an instance name of
my_ti; then add the following code to Frame 1.
/**
Requires:
- TextInput instance on Stage (instance name: my_ti)
*/
var my_ti:mx.controls.TextInput;
// Create listener object.
var tiListener:Object = new Object();
tiListener.change = function(evt_obj:Object) {
trace("Length of text: " + my_ti.length);
};
// Add listener.
my_ti.addEventListener("change", tiListener);