View comments | RSS feed

MovieClip._focusrect

Availability

Flash Player 6.

Usage

my_mc._focusrect:Boolean

Description

Property; a Boolean value that specifies whether a movie clip has a yellow rectangle around it when it has keyboard focus. This property can override the global _focusrect property. The default value of the _focusrect property of a movie clip instance is null; meaning, the movie clip instance does not override the global _focusrect property. If the _focusrect of a movie clip instance is set to true or false, it overrides the setting of the global _focusrect property for the single movie clip instance.

In Flash Player 4 or 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 the customization of _focusrect on an individual movie clip basis.

Example

This example demonstrates how to hide the yellow rectangle around a specified movie clip instance in a SWF file when it has focus in a browser window. Create three movie clips called mc1_mc, mc2_mc, and mc3_mc, and add the following ActionScript in Frame 1 of the Timeline:

mc1_mc._focusrect = true;
mc2_mc._focusrect = false;
mc3_mc._focusrect = true;

mc1_mc.onRelease = traceOnRelease;
mc3_mc.onRelease = traceOnRelease;

function traceOnRelease() {
   trace(this._name);
}

Test the SWF file in a browser window by selecting File > Publish Preview > HTML. Give the SWF focus by clicking it in the browser window, and press Tab to focus each instance. You will not be able to execute code for this movie clip in the browser by pressing Enter or the Spacebar when _focusrect is disabled.

Additionally, you can test your SWF file in the test environment. Select Control > Disable Keyboard Shortcuts from the main menu in the test environment. This allows you to view the focus rectangle around the instances in the SWF file.

See Also

Button._focusrect, _focusrect

Comments


Francis Cheng said on Apr 21, 2005 at 7:26 AM :
If the _focusrect property is set to false, then keyboard navigation for that movieclip 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.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001500.html