Textfield.restrict - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

TextField.restrict

Availability
Flash Player 6.
Usage
my_txt.restrict:String
Description
Property; indicates the set of characters that a user may enter into the text field. If the value of the
property is
restrict
an empty string, you can't enter any character. If the value of the
characters, you can enter only characters in the string into the text field. The string is scanned
from left to right. A range may be specified using the dash (-). This only restricts 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.
If the string begins with ^, all characters are initially accepted and succeeding characters in the
string are excluded from the set of accepted characters. If the string does not begin with ^, no
characters are initially accepted and succeeding characters in the string are included in the set of
accepted characters.
Example
The following example allows only uppercase characters, spaces, and numbers to be entered into
a text field:
my_txt.restrict = "A-Z 0-9";
The following example includes all characters, but excludes lowercase letters:
my_txt.restrict = "^a-z";
You can use a backslash to enter a ^ or - verbatim. The accepted backslash sequences are \-, \^ or
\\. The backslash must be an actual character in the string, so when specified in ActionScript, a
double backslash must be used. For example, the following code includes only the dash (-) and
caret (^):
my_txt.restrict = "\\-\\^";
The ^ may be used anywhere in the string to toggle between including characters and excluding
characters. The following code includes only uppercase letters, but excludes the uppercase
letter Q:
my_txt.restrict = "A-Z^Q";
You can use the
only the characters from ASCII 32 (space) to ASCII 126 (tilde).
my_txt.restrict = "\u0020-\u007E";
, you can enter any character. If the value of the
null
escape sequence to construct
\u
restrict
strings. The following code includes
restrict
property is
restrict
property is a string of
TextField.restrict
913

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents