11.21. Customizing the Tab Order


You want to specify the order in which form elements are chosen when the Tab key is pressed.


Use the tabIndex properties of the form elements to specify their sequence.


Flash provides an automatic sequence through which items on the Stage are accessed when the Tab key is pressed. This automatic sequence includes all movie clips, buttons, and text fields, and is not necessarily in an order that makes sense for your application. This poses two challenges. First of all, only certain elements in the movie (such as form elements) should be selectable via the Tab key. Second, you want form elements to be accessed in a specific order. It can be frustrating for your application’s users if pressing the Tab key after the first form element takes them to the last element instead of the next one.

Fortunately, you can specify a custom tab order for Flash to use and can include only those elements that you want to be selectable via the Tab key.


The Tab key cannot be detected reliably in Test Movie mode unless you select the Control Disable Keyboard Shortcuts option. Select Control Test Movie, wait for the .swf file to appear, and then disable keyboard shortcuts from the Control menu.

To specify a custom tab order, assign an order (integer) value to each of the element’s tabIndex properties. When a text field is selected and the user presses the Tab key, Flash looks at the text field’s tabIndex value; it then looks for the element with ...

Get Actionscript Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.