User Guide

894 Chapter 2: ActionScript Language Reference
TextField.maxChars
Availability
Flash Player 6.
Usage
my_txt.maxChars:Number
Description
Property; indicates the maximum number of characters that the text field can contain. A script
may insert more text than
maxChars allows; the maxChars property indicates only how much text
a user can enter. If the value of this property is
null, there is no limit on the amount of text a user
can enter.
Example
The following example creates a text field called age_txt that only lets users enter up to two
numbers in the field.
this.createTextField("age_txt", this.getNextHighestDepth(), 10, 10, 30, 22);
age_txt.type = "input";
age_txt.border = true;
age_txt.maxChars = 2;
age_txt.restrict = "0-9";