User Guide
1230 TextInput component
Because you must enter this expression within double quotation marks, you must not only
provide the expression for the restrict interpreter, but you must also escape the Actions panel’s
built-in interpreter for double quotation marks. To send the value
0-9\-\^\\ to the restrict
interpreter, you must enter the following code:
myText.restrict = "0-9\\-\\^\\\\";
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
The following example provides three different uses of the restrict property. The first usage
restricts input to uppercase characters A through Z, spaces, and numbers. The second usage
allows any characters except the lowercase characters a through z. The third usage allows only
numbers, -, ^, and \.
You must first drag a TextInput component to the Stage and give it an instance name of
my_ti; then add the code to Frame 1, using only one of the following restrict statements at
a time.
/**
Requires:
- TextInput instance on Stage (instance name: my_ti)
*/
var my_ti:mx.controls.TextInput;
// Example 1: Allow only uppercase A-Z, spaces, and digits 0-9.
my_ti.restrict = "A-Z 0-9";
// Example 2: Allow everything EXCEPT lowercase a-z.
my_ti.restrict = "^a-z";
// Example 3: Allow only digits 0-9, dash (-), ^, and \
my_ti.restrict = "0-9\\-\\^\\\\";