User Guide

722 FocusManager class
The Focus Manager handles focus changes caused by mouse clicks. If the user clicks a
component, that component is given focus.
Using Focus Manager
The Focus Manager does not automatically assign focus to a component. You must write a
script that calls
FocusManager.setFocus() on a component if you want a component to
have focus when an application loads.
To create focus navigation in an application, set the
tabIndex property on any objects
(including buttons) that should receive focus. When a user presses the Tab key, the Focus
Manager looks for an enabled object with a
tabIndex property that is higher than the current
value of
tabIndex. Once the Focus Manager reaches the highest tabIndex property, it
returns to zero. So, in the following example, the
comment object (probably a TextArea
component) receives focus first, and then the
okButton object receives focus:
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 (stacking
order, or z-order). The depth is 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 depth.
NOTE
When testing a script using Focus Manager (Control > Test Movie), select Control >
Disable Keyboard Shortcuts in test mode; otherwise, Focus Manager does not appear to
work. Also, tabbing and keyboard shortcuts are used by the authoring environment by
default. So, if you use test mode, the tab navigation, Enter key, and other key
combinations may perform in unexpected ways or appear to fail. Those features should
be tested in the Player outside the authoring environment.
NOTE
If you call FocusManager.setFocus() to set focus to a component when an application
loads, the focus ring does not appear around that component. The component has
focus, but the indicator is not present.