Using input text fields
37
Restricting character input
You can use the
SetInputTextType
command to restrict the characters that the user can
enter in the text input dialog box. For example, suppose an application contains an input text
field for the user to provide a numeric value, such as their age. And furthermore suppose that
the input text field has the variable name of
ageVar
.
To ensure that the user only enters numeric values into the text input dialog, you could add
the following code to your application:
fscommand2("SetInputTextType", "ageVar", "Numeric");
When the user opens the input text dialog box, they will only be able to enter numeric values
in the text fields.
For more information, see
SetInputTextType
in
Flash Lite 1.x ActionScript
Language Reference
.
Input text fields and the focus rectangle
By default, Flash Lite draws a yellow rectangle around the input text field that has keypad
focus, as the following image shows:
You can disable the focus rectangle by setting the global
_focusRect
property to
false
.
However, in that case, the user won’t be able to see that the text field has keypad focus and
won’t know to press the Select key on their device. Macromedia recommends that you do not
disable the focus rectangle when using input text fields.
For more information about controlling the behavior of the yellow focus rectangle, see
“About
the focus rectangle” on page 11
and
_focusrect
in
Flash Lite 1.x ActionScript
Language Reference
.