Issue

An editable text field in a Flash movie does not automatically get cursor focus when the movie is played. For example, if when creating an HTML-like form in Flash using Input Text fields, the cursor is not automatically present in any of the text fields.

Reason

Flash does not intuitively know where the cursor is supposed to be placed in the movie. To make the cursor appear in a text field you must first set the focus using ActionScript.

Solution

Use the setFocusmethod of the Selectionobject to give cursor focus to one of the editable text fields.

To set focus to an editable field:

1

First, make sure the text field is an Input Text field.

Select the text field to which you want to give focus and choose Windows > Panels > Text Options. In the Text Options panel, make sure Input Text is selected from the pop-up menu at the top of the panel.

2

Give the text field a variable name.

In the Variable field Text Options panel, enter a variable name for the text field such asyourTextField.

3

Add the following action to the frame in which the text field is located:

Selection.setFocus("yourTextField");

4 Test the movie in Flash (Control > Test Movie). The text field should display any text entered in the keyboard.

Note: This method may not always work when a Flash movie initially loads into a Web browser.Before thesetFocusmethod can give focus to a text field,the Flash movie itself needs to get focus from the Web browser. One way to achieve this is to make the end user to click somewhere on the movie (by way of a "Start" or "Enter" button for example) before they can interact further with it.





Keywords: tn_15513

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy