Creating an application with Focus Manager

The following procedure creates a focus scheme in a Flash application.

To create a focus scheme:

  1. Select File > New and choose Flash File (ActionScript 2.0).
  2. Drag the TextInput component from the Components panel to the Stage.
  3. In the Property inspector, assign it the instance name comment.
  4. Drag the Button component from the Components panel to the Stage.
  5. In the Property inspector, assign it the instance name okButton and set the label parameter to OK.
  6. In Frame 1 of the Actions panel, enter the following:
    comment.tabIndex = 1;
    okButton.tabIndex = 2;
    focusManager.setFocus(comment);
    function click(evt){
        trace(evt.type);
    }
    okButton.addEventListener("click", this);
    
  7. Select Control > Test Movie.
  8. Select Control > Disable Keyboard Shortcuts.

    The code sets the tab ordering. Although the comment field doesn't have an initial focus ring, it has initial focus, so you can start typing in the comment field without clicking in it. Also, you have to select the Disable Keyboard Shortcuts menu option for focus to work properly in test mode.