Tab Order (Setting)

Tab Order (Setting)

Flash CS4 ActionScript 3.0 Tutorial


How to Set the Tab Order of Text Fields Using Flash ActionScript



You may have created a form in Flash and the default tab order of the page text fields doesn't work. This tutorial explains how to set the tab order of the text fields.

Tutorial Elements

Three instances of the TextInput Component with instance names of text01_txt, text02_txt and text03_txt.


Step One

Open a new Flash document and name the default layer Text.

Step Two

Open the Components panel (Window > Components) and drag three TextInput components to the stage.

Step Three

Click each text field one at a time and input the following instance names in the Properties panel (text01_txt, text02_txt and text03_txt).

Step Four

Add a new layer and name the new layer Actions.

Step Five

Option double-click (PC - Alt double-click) frame one of the Actions layer.

Step Six

Copy/Paste the following code to the ActionScript panel.





Step Seven

Publish your movie by pressing Cmd/Return (PC - Ctrl/Enter). Place your curser inside the highlighted box and click. Enter your text, then press the tab key to jump to the next text box.

Dissecting the Code

The first line of the code at Step Six sets the focus, in other words, it adds a highlight box around the first text field to show the user where to start.

Lines two through four set the tab numbers for each text field. By changing the numbers, the tab order is altered.