User Guide
58 Working with Components
Using code hints
When you are using ActionScript 2.0, you can use strict typing for a variable that is based on
a built-in class, including component classes. If you do so, the ActionScript editor displays
code hints for the variable. For example, suppose you type the following:
import mx.controls.CheckBox;
var myCheckBox:CheckBox;
myCheckBox.
As soon as you type the period after myCheckBox, Flash displays a list of methods and
properties available for CheckBox components, because you have designated the variable as
type CheckBox. For more information, see “About assigning data types and strict data typing”
and “Using code hints” in Learning ActionScript 2.0 in Flash.
Creating custom focus navigation
When a user presses the Tab key to navigate in a Flash application or clicks in an application,
the FocusManager class determines which component receives input focus (for more
information see FocusManager class in the Components Language Reference). You don’t need
to add a FocusManager instance to an application or write any code to activate the
Focus Manager.
If a RadioButton object receives focus, the Focus Manager examines that object and all objects
with the same
groupName value and sets focus on the object with the selected property set
to
true.
Each modal Window component contains an instance of the Focus Manager, so the controls
on that window become their own tab set. This prevents a user from inadvertently navigating
to components in other windows by pressing the Tab key.
To create focus navigation in an application, set the
tabIndex property on any components
(including buttons) that should receive focus. When a user presses the Tab key, the
FocusManager class looks for an enabled object whose
tabIndex value is greater than the
current value of
tabIndex. After the FocusManager class reaches the highest tabIndex
property, it returns to 0. For example, in the following code, the
comment object (probably a
TextArea component) receives focus first, and then the
okButton instance receives focus:
var comment:mx.controls.TextArea;
var okButton:mx.controls.Button;
comment.tabIndex = 1;
okButton.tabIndex = 2;
You can also use the Accessibility panel to assign a tab index value.