Tutorials Books Videos Forums

Change the theme! Search!
Rambo ftw!

Customize Theme


Color

Background


Done

Tab Ordering Forms

by kirupa   | filed under Flash and ActionScript

If you're viewing this tutorial, it's probably because you're one of those flashers that are trying to use the tab key to only focus on a certain type of object in flash.

[ Click Name and use the tab key as you type ]

In this case, we're going to make the tab focus on textboxes. The problem here is that when the tab key is pressed to scroll through the form inputs, it can sometimes scroll through other objects like buttons too, which can be annoying.

Note

When you press tab the 4th time, notice it won't go back to the name input box. That's because tab also works for HTML, so it will scroll through the navigation bar on the left of this tutorial. But when you make your swf and publish it as a website with no HTML elements, it will work perfectly.

Here Is How:

  1. Open up a new flash document and use the text tool to create 3 input textboxes. Give the first one the instance name of name, the second location and the third age for the example.

    Textbox Settings

  2. Now you can make some text next to the inputs saying name, location, etc.
  3. In a new layer, open up the actions panel (f9) and insert this into it:
    name.tabIndex = 1;
    location.tabIndex = 2;
    age.tabIndex = 3;

    Explanation

    This states that name is the textboxes instance name. tabIndex = 1; states that it is the first one it will focus into when the tab key is pressed. You can now control which one goes after which.

  4. Test the movie.

That's it! All you did was create the boxes, name them and add the script. Now when you create a form with lots of objects such as buttons and whatnot, you can have the tab key work specifically for your text boxes.

Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy kirupa's books, became a paid subscriber, watch the videos, and/or interact on the forums.

Your support keeps this site going! 😇

Kirupa's signature!

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright KIRUPA 2026 //--