User Guide
Managing component depth in a document 59
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 (API) 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 in the Components Language Reference.
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 in the Components Language Reference. The methods of
the DepthManager class allows you to place user interface components in an appropriate
relative 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.
The following code places the component instance
loader at a lower depth than the button
component (and in the published SWF file it will appear “below” the button, if they overlap):
loader.setDepthBelow(button);
NOTE
You can also manage relative depths using Layers and the Modify > Arrange menu
options within your document. Components adhere to the same rules for runtime depth
management using layers and arrangement as do movie clips.