Creating tab order in FlashMX 2004 can be done several ways. You can use the built-in tab order that exists in any published SWF. Or, you can create your own custom tab order using the tabIndex property of MovieClips, Buttons, and according to Macromedia dynamic and input text fields. Additionally, you could avoid the two methods above and "roll" your own tab ordering system.
The auto-tabbing system is built-in to every published SWF file. That is, if you don't disable it. The order tabs are executed on your objects seems relatively random and cannot be controlled. If you would like more information on how the auto-tabbing system determines what should be tabbed when, check out this Flash technote.
Using Tab Index
A second option is to use what Macromedia calls "custom tabbing." This involves setting the tabIndex property on objects that can be tabbed. Using this property you can create your own tab order using whatever numbers you want. For instance, you can give a button a tabIndex value of 1 and a movieclip a tabIndex of 2. The button will then be tabbed before the movieclip. The numbers you choose to assign to the tabIndex property can be whatever you want. For instance, you can start at 200 or 500 and you can even skip numbers. The Flash player will simply tab through the numbers from least to greatest.
Roll Your Own System
Highly complex movies or perhaps Rich Internet Applications may require a more robust solution than auto-tabbing and custom tabbing can provide. In these cases, disabling all tabbing controls and creating your own solution might be your only recourse. One case where this type of solution would be useful is if you need one or more things to happen when objects receive focus (via tab or shift-tab). I used this type of solution recently when I needed to make a call outside of Flash (to Director) when objects received focus via tab or shift-tab. In my case, I was creating a relatively high level of accessibility with a custom tab structure. I also needed to make calls to Director in order to make use of a text-to-speech engine that would read any English text I sent it. The issue here is that I needed several things to happen when objects were tabbed. So I created an AS2 class that implemented listeners for the Key object - specifically tab and shift-tab and performed a certain set of code when objects were tabbed. The tab structure was not set up with auto-tabbing or tabIndex as I disabled these features with the following lines:
MovieClip.prototype.tabEnabled = false;
Button.prototype.tabEnabled = false;
TextField.prototype.tabEnabled = false;
The tabEnabled property disables both auto-tabbing and use of the tabIndex property. Since these features were disabled my custom class could listen for tab and shift-tab and execute the appropriate code where necessary.
For some Flash movies auto-tabbing or custom tabbing will be a viable solution. In other cases where a more robust solution is needed rolling your own tabbing structure is necessary. However, in order for your tabbing structure to work as you expect it is necessary to disable all built-in tabbing by setting the tabEnabled property to false on the three objects MovieClip, Button, and TextField.
About this post:
This entry was posted by Aaron West on July 19, 2004 at 9:29 AM. It was filed in the following categories: Flash. It has been viewed 4047 times and has 0 comments.