3 Replies Latest reply on Nov 17, 2009 3:20 PM by Flex harUI

    tabIndex not working

    Adobe Joe Kenobi Level 1

      I have an application that I am creating in Flex Builder that uses swc components from Flash created using the Flex Component Kit. Those components have text input fields in them from Flash. The trouble I am having is when I try to set the tabIndex on those text input fields nothing happens. Here is a sample of the code:

       

      private function assignTabOrder():void

      {

           firstName_txt.tabIndex = 1;

           lastName_txt.tabIndex = 2;

           email_txt.tabIndex = 3;

           verifyEmail_txt.tabIndex = 4;

           username_txt.tabIndex = 5;

           password_txt.tabIndex = 6;

           verifyPassword_txt.tabIndex = 7;

           challenge_cb.tabIndex = 8;

           answer_txt.tabIndex = 9;

           ok_btn.tabIndex = 10;

      }

       

      This function is called and executed, but when I click into the first field and then hit tab nothing happens. The focus stays in the first field. I seem to be finding a lot of different issues when it comes to accessing flash components (ie textfields) from Flex. Does anyone know how to get around this? Also is there a problem with making a swc in flash that uses the flash components (ie textfields)?

        • 1. Re: tabIndex not working
          captain_code-KOo9rr Level 1

          Obviously this is hacky, and really clunky, and doesn't really solve the problem. but a potential workaround, emphasis on workaround,would be to listen for keystrokes and manually do your own tab index. That also doesn't help with accessibility, but it is an idea at the least. One benefit is it would allow you to see if you can manually transfer the focus with Flash. Also, what happens when you don't set a tabIndex?

          1 person found this helpful
          • 2. Re: tabIndex not working
            Adobe Joe Kenobi Level 1

            That is a good idea. If I can't get it working I might try that. When I don't set the tab index it does tab from field to field just in a random order. When I attempt to set the tabIndex it always returns the focus to the first box even when I click in a different box and then hit tab.

            • 3. Re: tabIndex not working
              Flex harUI Adobe Employee

              The Flex FocusManager is only going to assing focus to IFocusManagerComponents.  You'll have to do a bit of work to get your Flash component to be an IFocusManagerComponent (I think it is already) and then teach it to handle multiple tab targets.  There are examples of handling multiple tab targets in DataGrid.as and List.as.  They override the keyFocusChange handler.

               

              Another solution may be to make each TextField an IFocusManagerComponent and make the wrapping component a "container" by setting its tabChildren=true.

               

              Alex Harui

              Flex SDK Developer

              Adobe Systems Inc.

              Blog: http://blogs.adobe.com/aharui