User Guide
FocusManager class 421
If a Flash application is playing in a web browser, the application doesn’t have focus until a user
clicks somewhere in the application. Also, once a user clicks in the Flash application, pressing Tab
can cause focus to jump outside the Flash application. To keep tabbing limited to objects inside
the Flash application in Flash Player 7 ActiveX control, add the following parameter to the
HTML
<object> tag:
<param name="SeamlessTabbing" value="false"/>
Creating an application with the Focus Manager
The following procedure creates a focus scheme in a Flash application.
To create a focus scheme:
1.
Drag the TextInput component from the Components panel to the Stage.
2.
In the Property inspector, assign it the instance name comment.
3.
Drag the Button component from the Components panel to the Stage.
4.
In the Property inspector, assign it the instance name okButton and set the label parameter
to OK.
5.
In Frame 1 of the Actions panel, enter the following:
comment.tabIndex = 1;
okButton.tabIndex = 2;
focusManager.setFocus(comment);
function click(evt){
trace(evt.type);
}
okButton.addEventListener("click", this);
This code sets the tab ordering. Although the comment field doesn’t have a focus ring, it has
initial focus, so you can start typing in the comment field without clicking on it.
Customizing the Focus Manager
You can change the color of the focus ring in the Halo theme by changing the value of the
themeColor style, as in this example:
_global.style.setStyle("themeColor", "haloBlue");
The Focus Manager uses a FocusRect skin for drawing focus. This skin can be replaced or
modified and subclasses can override
UIComponent.drawFocus to draw custom focus indicators.
FocusManager class (API)
Inheritance MovieClip > UIObject class > UIComponent class > FocusManager
ActionScript Class Name mx.managers.FocusManager
You can use the Focus Manager 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 FocusManager class to
set a button in your document that receives keyboard input when a user presses Enter (Windows)
or Return (Macintosh).