2 Replies Latest reply on Sep 7, 2010 1:14 AM by twessss

    focus navigation with enter key between controls

    twessss

      hi,

       

      i've an app and i wanna change control focuses one to other one with pressing enter key..i think keyFocusChange property solve my prob but i couldnt fix it..

      text input

       

      button

       

      helppp pls.

      thnx

        • 1. Re: focus navigation with enter key between controls
          krafttimd Level 2

          If the objects that do the navigation have a keyDown event you could listen for that event and switch the focus using the FocusManager. However, once an item has focus pressing the Tab key or Shift + Tab automatically seems to work fine for shifting focus within forms, ButtonBars, TabNavigators etc...

           

          If you need to do the navigation on pressing the enter button, the keyboardEvent raised by a keyDown event in on a flash.display.InteractivObject has a keyCode which you can inspect to determine if the enter key was pressed.

           

          T.K.

          1 person found this helpful
          • 2. Re: focus navigation with enter key between controls
            twessss Level 1

            thnx krafttimd for help..

             

            i solved it with an easily way..i used textInput s enter event and generate a handler.

             

            <s:TextInput id="kod" enter="kod_enterHandler(event)" />

             

            <s:TextInput id="sifre" enter="sifre_enterHandler(event)" />

             

            <mx:Button id="giris"  keyDown="giris_keyDownHandler(event)" click="checkLogin()"/>

             

             

            protected function kod_enterHandler(event:FlexEvent):void

            {

            sifre.setFocus();

            }

              

             

            protected function sifre_enterHandler(event:FlexEvent):void

            {

            giris.setFocus();

            }

             

              

             

            protected function giris_keyDownHandler(event:KeyboardEvent):void

            {

            if(event.keyCode == Keyboard.ENTER) checkLogin();

            }