2 Replies Latest reply on Jan 2, 2008 9:26 AM by GYorky

    tab order (tabbing )

    kaurj
      Hi,
      Is there a way we can stop the tab from going out of flex component to Internet explorer. When i tab through my app after the last text field the tab goes to the foot bar of IE and then to header and then to address bar and then back to the main component. Is there a way i can stop it from going out of the flex component. I tried tabIndex but it doesn't seem to work. Please reply with examples.

      Thanks
        • 1. Re: tab order (tabbing )
          gur_sukh
          Has anyone got seamlessTabbing to work for then in flash 9
          • 2. Re: tab order (tabbing )
            GYorky
            Yes

            In your application MXML tag, put the following

            keyFocusChange="appFocusOut(event)"

            Then, inside a <mx:Script> block, add the following function

            private function appFocusOut(event:FocusEvent):void
            {
            // Check that the focus isn't leaving the application
            if (!event.relatedObject)
            {
            event.preventDefault(); //Stop the tab index leaving
            var first:IFocusManagerComponent = focusManager.getNextFocusManagerComponent();
            first.setFocus();
            }
            }



            What this does is check whenever the user presses the tab key to make sure that the application has somewhere to tab to inside Flex. The keyFocusChange event is triggered before the tab moves out of the field, giving you the chance to cancel it

            If event.relatedObject is null, that means that Flex is going to move the tab focus outside the application. To prevent this happening, we call event.preventDefault(). Finally, to make the tabbing loop round, we call focusManager.getNextFocusManagerComponent().setFocus();