R – In AIR how to set focus on textinput on application load

airapache-flex

On my application I have a login form. On application start, I want the focus/selected one is set on the user id textinput.

I tried normal setFocus method and didnt worked.

How can i make it work?

Best Answer

This works for me with Flex 3 and AIR 1.5:

<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">

  <mx:applicationComplete>
    ti.setFocus();
  </mx:applicationComplete>

  <mx:TextInput id="ti"/>

</mx:WindowedApplication>
Related Topic