User Guide

Managing component depth in a document 51
comment.tabIndex = 1;
okButton.tabIndex = 2;
You can also use the Accessibility panel to assign a tab index value.
If nothing on the Stage has a tab index value, the Focus Manager uses the depth levels (z-order).
The depth levels are set up primarily by the order in which components are dragged to the Stage;
however, you can also use the Modify > Arrange > Bring to Front/Send to Back commands to
determine the final z-order.
To give focus to a component in an application, call
focusManager.setFocus().
To create a button that receives focus when a user presses Enter (Windows) or Return
(Macintosh), set the
FocusManager.defaultPushButton property to the instance of the desired
button, as in the following code:
focusManager.defaultPushButton = okButton;
The FocusManager class overrides the default Flash Player focus rectangle and draws a custom
focus rectangle with rounded corners.
For more information about creating a focus scheme in a Flash application, see “FocusManager
class” on page 419.
Managing component depth in a document
If you want to position a component in front of or behind another object in an application, you
must use the DepthManager class. The methods of the DepthManager class allows you to place
user interface components in an appropriate z-order (for example, a combo box drops down in
front of other components, insertion points appear in front of everything, dialog boxes float over
content, and so on).
The Depth Manager has two main purposes: to manage the relative depth assignments within any
document, and to manage reserved depths on the root Timeline for system-level services such as
the cursor and tooltips.
To use the Depth Manager, call its methods (see “DepthManager class” on page 406).
The following code places the component instance
loader below the button component:
loader.setDepthBelow(button);