Archived:How to use a text input field in FlashLite
Compatibility: Flash Lite: 1.1, 2.x
Making a simple text field
- Using the Text tool, drag a text field.
- In Properties tab, select Input Text and fill the Var field to link it to a variable. (myText in this example).
- To edit a text field, users must first give an input text field focus, and then press their device's select key. By default, a yellow rectangle will be drawn around the input text field that has focus .
- When a user edit a text field, the linked variable (myText here) will contain this value.
Custom input text
- Numerical input field
You can make an input text field allowing numbers only by executing this code:
fscommand2("SetInputTextType", "myText", "Numeric");
- Set maximum characters allowed
Select you text field, then fill the Maximum characters in the Properties tab.
- Sets the color of the focus rectangle (Flash Lite 2.x only)
You can change the color of the focus rectangle (yellow by default) by using the following statement:
fscommand2("SetFocusRectColor", 255, 153, 0); //Orange
To reset the color of the focus rectangle:
fscommand2("SetFocusRectColor", <red>, <green>, <blue>);
You can download an example with source code here:
Input Text 240*320 (swf + fla)