1 Reply Latest reply on Feb 6, 2009 1:54 PM by ricekingusa

    FL3 AS2: force focus

    ricekingusa
      Hello & thanks in advance for your comments,

      I'm working on a Flash Lite 3.0 AS 2.0 (mobile) file. Currently I am making some custom components for a project & I've ran into a small stop. Currently I have a combo box, when the user selects it & presses Soft Key 1 the component will go into edit mode where the user can only select the elements in the combo box. Once they are done, the user presses the Soft Key 1 again to exit the edit mode.

      My problem is, once I exit edit mode, the combo box isn't automatically selected.

      Currently the code i have when the user is done editing the box (this is code in a button within the combo box) is:
        • 1. Re: FL3 AS2: force focus
          ricekingusa Level 1
          I've been trying to figure more out about Selection.setFocus & I have changed the code up a little more to understand the results.

          according to Flash CS3 Documentation:
          quote:

          setFocus (Selection.setFocus method)

          public static setFocus(newFocus:Object) : Boolean

          Gives focus to the selectable (editable) text field, button, or movie clip, specified by the newFocus parameter. If null or undefined is passed, the current focus is removed.

          Availability: ActionScript 1.0; Flash Player 5 - Instance names for buttons and movie clips work only in Flash Player 6 and later.
          Parameters

          newFocus:Object - An object such as a button, movie clip or text field instance, or a string specifying the path to a button, movie clip, or text field instance. If you pass a string literal specifying a path, enclose the path in quotation marks (" "). You can use dot or slash notation to specify the path. If you are using ActionScript 2.0, you must use dot notation. You can use a relative or absolute path.
          Returns

          Boolean - A Boolean value; true if the focus attempt is successful, false if it fails.


          Here is the results from the code below:
          Current Focus: _level0.Combo1.BoxShown4
          _parent of current focus: _level0.Combo1
          _parent.tabEnabled: true
          Set current focus to null: true
          Current focus: null
          Set current focus to _parent: false
          Current focus: null