User Guide
TextInput component 755
The restrict property restricts only user interaction; a script may put any text into the text
field. This property does not synchronize with the Embed Font Outlines check boxes in the
Property inspector.
Example
In the following example, the first line of code limits the text field to uppercase letters, numbers,
and spaces. The second line of code allows all characters except lowercase letters.
my_txt.restrict = "A-Z 0-9";
my_txt.restrict = "^a-z";
The following code allows a user to enter the characters “0 1 2 3 4 5 6 7 8 9 - ^ \” in the instance
myText. You must use a double backslash to escape the characters -, ^, and \. The first \ escapes
the double quotation marks, and the second
\ tells the interpreter that the next character should
not be treated as a special character.
myText.restrict = "0-9\\-\\^\\\\";
TextInput.text
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
textInputInstance.text
Description
Property; the text contents of a TextInput component. The default value is "" (an empty string).
Example
The following code places a string in the myTextInput instance, and then traces that string to the
Output panel:
myTextInput.text = "The Royal Nonesuch";
trace(myTextInput.text); // traces "The Royal Nonesuch"