User Guide
721
23
CHAPTER 23
FocusManager class
You can use the Focus Manager class to specify the order in which components receive focus
when a user presses the Tab key to navigate in an application. You can also use the Focus
Manager to set a button in your document that receives keyboard input when a user presses
Enter (Windows) or Return (Macintosh). For example, when users fill out a form, they
should be able to tab between fields and press Enter (Windows) or Return (Macintosh) to
submit the form.
All components implement Focus Manager support; you don’t need to write code to invoke
the FocusManager class.
The Focus Manager interacts with the System Manager, which activates and deactivates
FocusManager instances as pop-up windows are activated or deactivated. Each modal window
has an instance of FocusManager so the components in that window become their own tab
set, preventing the user from tabbing into components in other windows.
The Focus Manager recognizes groups of radio buttons (those with a defined
RadioButton.groupName property) and sets focus to the instance in the group that has a
selected property that is set to true. When the Tab key is pressed, the Focus Manager
checks to see if the next object has the same group name as the current object. If it does, it
automatically moves focus to the next object with a different group name. Other sets of
components that support a
groupName property can also use this feature.
NOTE
Focus Manager support overrides the use of the on(keyPress) global handler. Because
all components implement Focus Manager, an application that includes components
and uses the on(keyPress) global handler needs to have a tabIndex for every control
(including components and movie clips) set, explicitly (see “Using Focus Manager”
on page 722). Or, preferably, you can add an event listener for a specific Key and the
Focus Manager will not override the corresponding event handler. For more information
about creating an event listener for a Key, see “Capturing keypresses” in Learning
ActionScript 2.0 in Flash.