User Guide

276 ActionScript classes
_focusrect (Button._focusrect property)
public _focusrect : Boolean
A Boolean value that specifies whether a button has a yellow rectangle around it when it has
input focus. This property can override the global
_focusrect property. By default, the
_focusrect property of a button instance is null; the button instance does not override the
global
_focusrect property. If the _focusrect property of a button instance is set to true or
false, it overrides the setting of the global _focusrect property for the single button
instance.
In Flash Player 4 and Flash Player 5 SWF files, the
_focusrect property controls the global
_focusrect property. It is a Boolean value. This behavior was changed in Flash Player 6 and
later to permit customizing the
_focusrect property on an individual movie clip.
If the
_focusrect property is set to false, then keyboard navigation for that button is
limited to the Tab key. All other keys, including the Enter and arrow keys, are ignored. To
restore full keyboard navigation, you must set
_focusrect to true.
Note: For the Flash Lite 2.0 player, when the
_focusrect property is disabled (in other
words,
Button.focusRect is false), the button receives all events. This behavior is
different from Flash Player behavior because when the
_focusrect property is disabled, the
button receives the
rollOver and rollOut events but does not receive the press and
release events.
Also for Flash Lite 2.0, you can change the color of the focus rectangle using the fscommand2
SetFocusRectColor command. This behavior is also different from Flash Player, for which
the color of the focus rectangle is restricted to yellow.
Availability: ActionScript 1.0; Flash Lite 2.0
Example
This example demonstrates how to hide the yellow rectangle around a specified button
instance in a SWF file when it has focus in a browser window. Create three buttons called
myBtn1_btn, myBtn2_btn, and myBtn3_btn, and add the following ActionScript to Frame 1
of the Timeline:
myBtn2_btn._focusrect = false;
Make sure that you disable keyboard shortcuts when you test the SWF file by selecting
Control > Disable Keyboard Shortcuts in the test environment.
When
_focusrect is disabled, you cannot execute code for this button by pressing Enter or
the Spacebar.