×
Namespaces

Variants
Actions
Revision as of 19:57, 17 August 2009 by manikantan (Talk | contribs)

Archived:How to use a text input field in FlashLite

From Nokia Developer Wiki
Jump to: navigation, search


Compatibility: Flash Lite: 1.1, 2.x, 3.x

Contents

Making a simple text field

FlashLite 2

  • 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).
    Input prop.jpg


  • 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 .
    Input focus.jpg


  • When a user edit a text field, the linked variable (myText here) will contain this value.

FlashLite 2.1 and 3.x

Limitation of Input TextField in Flash Lite 2.0

  • Flash Lite 2.0 does not support inline text input.
  • When user has to enter in textfield, user is prompted with a Modal Dialog Box which appears over the FlashLite application.
  • Before entering in the textfield, user must set the focus to textfield and also activate it using the device Select key.
  • Flash Lite 2.0 does not have the ability to set text selections.

Using Inline TextField in Flash Lite 2.1 and 3.x

Using inline text-field user can edit the textfield directly in the FlashLite application rather than in seperate model input box. In case of inline text input Flash Lite player does not process the user input directly but devices native input method editor is used. When the inline text field is active, Flash Lite player can not execute any instruction as Flash Lite player runs in restricted mode. Only after the text field is deactivated, Flash Lite player runs in norml mode.

When the user is entering text in the input field, Flash Lite player uses Input Mode Indicator to indicate if it is alpha input(Indicated by letter 'A') or numeric input(Indicated by sign '#').

After user sets focus to input text-field, it is not necessary for user to press the devices Select key in case the application contains following text field activation code.

var objFocusListener:Object = new Object ();
objFocusListener.onSetFocus = function (oldFocus, newFocus) {
 
fscommand ("activateTextField", "");
 
};
TextFieldInstanceName.addListener (objFocusListener);

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>);

Download

You can download an example with source code here:
Input Text 240*320 (swf + fla)
Input example.jpg


Further Reading

Creating Specialised TextFields

83 page views in the last 30 days.
×