ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
fl.managers 

IFocusManager  - AS3 Flash

Packagefl.managers
Interfacepublic interface IFocusManager
Implementors FocusManager

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Implement the IFocusManager interface to create a custom focus manager. A focus manager enables an application to transfer focus among components when the user moves the mouse or presses the Tab key.

Related API Elements



Public Properties
 PropertyDefined By
  defaultButton : Button
Gets or sets a reference to the default button.
IFocusManager
  defaultButtonEnabled : Boolean
Gets or sets a value that indicates whether the default button is enabled.
IFocusManager
  form : DisplayObjectContainer
Base DisplayObjectContainer for the IFocusManager, usually the stage.
IFocusManager
  nextTabIndex : int
[read-only] Gets the next unique tab index to use in the current tab loop.
IFocusManager
  showFocusIndicator : Boolean
Gets or sets a value that determines whether the user interface changes to indicate that a specific component has focus.
IFocusManager
Public Methods
 MethodDefined By
  
Activates a focus manager.
IFocusManager
  
Deactivates a focus manager.
IFocusManager
  
Retrieves the IFocusManagerComponent object that contains the specified object, if there is one.
IFocusManager
  
Retrieves the IFocusManagerComponent component that currently has focus.
IFocusManager
  
Retrieves the component that receives focus next if the user causes focus to move by using the Tab key.
IFocusManager
  
Sets the showFocusIndicator property to false.
IFocusManager
  
Sets focus to an IFocusManagerComponent component.
IFocusManager
  
Sets the showFocusIndicator property to true.
IFocusManager
Property Detail

defaultButton

property
defaultButton:Button

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Gets or sets a reference to the default button. The default button serves as a proxy button for any component that has focus when the Enter key is pressed. The pressing of the Enter key triggers a click event to be dispatched on the default button on behalf of the component that has focus. Button components do not require default buttons. When focus moves to a Button component it cannot trigger the default button; if focus moves from a Button component to a component that is not a button, the default button may be triggered again.



Implementation
    public function get defaultButton():Button
    public function set defaultButton(value:Button):void

defaultButtonEnabled

property 
defaultButtonEnabled:Boolean

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Gets or sets a value that indicates whether the default button is enabled. If this value is set to true, the focus manager monitors the Enter key and dispatches a click event on the default button if the Enter key is pressed when a component that is not a Button component has focus. If this value is set to false, the focus manager does not monitor the Enter key. Components that use the Enter key set this property to false to prevent a click event from being dispatched on the default button, if one exists, when a user presses the Enter key.



Implementation
    public function get defaultButtonEnabled():Boolean
    public function set defaultButtonEnabled(value:Boolean):void

form

property 
form:DisplayObjectContainer

Language Version: ActionScript 3.0
Product Version: Flash CS5.5
Runtime Versions: AIR 1.0, Flash Player 9.0.28.0

Base DisplayObjectContainer for the IFocusManager, usually the stage.



Implementation
    public function get form():DisplayObjectContainer
    public function set form(value:DisplayObjectContainer):void

nextTabIndex

property 
nextTabIndex:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Gets the next unique tab index to use in the current tab loop. A tab loop includes one or more components that are managed by a focus manager.



Implementation
    public function get nextTabIndex():int

showFocusIndicator

property 
showFocusIndicator:Boolean

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Gets or sets a value that determines whether the user interface changes to indicate that a specific component has focus.

If this property is set to true, a component that has focus is marked with a visual indicator. If it is set to false, a visual indicator of focus is not used.

By default, this property is set to false until the user presses the Tab key; then it is set to true.



Implementation
    public function get showFocusIndicator():Boolean
    public function set showFocusIndicator(value:Boolean):void
Method Detail

activate

()method
public function activate():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Activates a focus manager.

When multiple DisplayObjectContainer objects are displayed on the screen at the same time, the system manager activates and deactivates their FocusManager objects as focus moves from one container to the next. When focus moves to a component in an DisplayObjectContainer object whose focus manager is deactivated, the system manager activates that focus manager by making a call to the activate() method. Only one focus manager is active at a time; before activating a focus manager the system manager uses the deactivate() method to deactivate an active focus manager whose components have lost focus.

deactivate

()method 
public function deactivate():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Deactivates a focus manager.

When multiple DisplayObjectContainer objects are displayed on the screen at the same time, the system manager activates and deactivates their FocusManager objects as focus moves from one container to the next. When focus moves to a component in an DisplayObjectContainer object whose focus manager is deactivated, the system manager activates that focus manager by making a call to the activate() method. Only one focus manager is active at a time; before activating a focus manager the system manager uses the deactivate() method to deactivate an active focus manager whose components have lost focus.

findFocusManagerComponent

()method 
public function findFocusManagerComponent(component:InteractiveObject):InteractiveObject

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Retrieves the IFocusManagerComponent object that contains the specified object, if there is one.

Flash Player can set focus on subcomponents as well as on components themselves. This method is used to find the component that either has focus or contains the subcomponent that has focus.

Parameters

component:InteractiveObject — An object that can have Flash Player-level focus.

Returns
InteractiveObject — The IFocusManagerComponent that contains the specified object; otherwise, this method returns null.

getFocus

()method 
public function getFocus():InteractiveObject

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Retrieves the IFocusManagerComponent component that currently has focus. Use this method to determine which component has focus. Using the Stage object to find out which component has focus may result in the return of the subcomponent of the component that has focus.

Returns
InteractiveObject — IFocusManagerComponent object that has focus.

getNextFocusManagerComponent

()method 
public function getNextFocusManagerComponent(backward:Boolean = false):InteractiveObject

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Retrieves the component that receives focus next if the user causes focus to move by using the Tab key.

This method can be used to detect the next component to receive focus in the tab loop if focus moves by one element in either a forward or backward direction. If the application does not contain other valid components, this method retrieves the current component that has focus.

Parameters

backward:Boolean (default = false) — Indicates whether focus moves in a backward direction through the tab loop. If this value is true, this method returns the component that would have focus if focus were moved in a backward direction by the user pressing the Shift+Tab key combination.

Returns
InteractiveObject — The component that is next to receive focus.

hideFocus

()method 
public function hideFocus():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Sets the showFocusIndicator property to false. If a component that has focus is marked with a visual indicator of focus, this method removes that indicator.

setFocus

()method 
public function setFocus(o:InteractiveObject):void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Sets focus to an IFocusManagerComponent component. This method does not check for component visibility, enabled state, or any other conditions.

Parameters

o:InteractiveObject — The component that is to receive focus.

showFocus

()method 
public function showFocus():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Sets the showFocusIndicator property to true. If a component has focus, this method draws the visual focus indicator on that component.