TextInput.restrict
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
textInputInstance.restrict
Description
Property; indicates the set of characters that a user can enter in the text field. The default value is
. If this property is
undefined
property is a string of characters, the user can enter only characters in the string; the string is
scanned from left to right. You can specify a range by using a dash (-).
If the string begins with
If the string does not begin with
can also be used as a toggle between acceptable and unacceptable characters.
For example, the following code allows A-Z except X and Q:
Ta.restrict = "A-Z^XQ";
You can use the backslash (
here:
\^
\-
\\
When you enter the
special meaning for the Actions panel's double-quote interpreter. It signifies that the character
following the
should be treated as is. For example, you could use the following code to enter a
\
single quotation mark:
var leftQuote = "\'";
The Actions panel's restrict interpreter also uses
think that the following should work:
myText.restrict = "0-9\-\^\\";
However, since this expression is surrounded by double quotation marks, the following value is
sent to the restrict interpreter:
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
interpreter, you must enter the following code:
myText.restrict = "0-9\\-\\^\\\\";
754
Chapter 6: Components Dictionary
or an empty string (
null
, all characters that follow the
^
, the characters in the string are considered acceptable. The
^
) to enter a hyphen (
\
character in the Actions panel within double quotation marks, it has a
\
, and the restrict interpreter doesn't understand this value.
0-9-^\
), a user can enter any character. If this
""
are considered unacceptable characters.
^
), caret (
), or backslash (
-
^
as an escape character. Therefore, you may
\
0-9\-\^\\
^
) character, as shown
\
to the restrict
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers