TextInput.maxChars

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

textInputInstance.maxChars

Description

Property; the maximum number of characters that the text field can contain. A script may insert more text than the maxChars property allows; this property indicates only how much text a user can enter. If this property is null, there is no limit to the amount of text a user can enter. The default value is null.

Example

The following example limits to eight the number of characters a user can enter in the TextInput instance called my_ti. It also sets the password property, which hides the input characters by displaying an asterisk in place of the character that was entered.

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;

my_ti.maxChars = 8;
my_ti.password = true;