User Guide
Using Focus Manager 723
To create a button that receives focus when a user presses Enter (Windows) or Return
(Macintosh), set the
FocusManager.defaultPushButton property to the instance name of
the desired button, as shown here:
focusManager.defaultPushButton = okButton;
Using Focus Manager to allow tabbing
You can use the Focus Manager to create a scheme that allows users to press the Tab key to
cycle through objects in a Flash application. (Objects in the tab scheme are called tab targets.)
The Focus Manager examines the
tabEnabled and tabChildren properties of the objects’
parents in order to locate the objects.
A movie clip can be either a container of tab targets, a tab target itself, or neither:
Consider the following scenario. On the Stage of the main timeline are two text fields (
txt1
and
txt2) and a movie clip (mc) that contains a DataGrid component (grid1) and another
text field (
txt3). You would use the following code to allow users to press Tab and cycle
through the objects in the following order:
txt1, txt2, grid1, txt3.
NOTE
The Focus Manager is sensitive to when objects are placed on the Stage (the depth
order of objects) and not their relative positions on the Stage. This is different from the
way Flash Player handles tabbing.
Movie clip type tabEnabled tabChildren
Container of tab targets
false true
Tab target
true false
Neither
false false
NOTE
This is different from the default Flash Player behavior, in which a container’s
tabChildren property can be undefined.
NOTE
The FocusManager and TextField instances are enabled by default.