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

IFocusManagerComponent  - AS3 Flash

Packagefl.managers
Interfacepublic interface IFocusManagerComponent
Implementors Button, ColorPicker, ComboBox, DataGrid, LabelButton, List, NumericStepper, ScrollPane, SelectableList, Slider, TextArea, TextInput, TileList

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

The IFocusManagerComponent interface provides methods and properties that give components the capability to receive focus. Components must implement this interface to receive focus from the FocusManager.

The UIComponent class provides a base implementation of this interface but does not fully implement it because not all UIComponent objects receive focus. Components that are derived from the UIComponent class must implement this interface to be capable of receiving focus. To enable focus, add the statement implements IFocusManagerComponent to the class definition of a component that is derived from the UIComponent class.

Related API Elements



Public Properties
 PropertyDefined By
  focusEnabled : Boolean
Gets or sets a Boolean value that indicates whether a selected component can receive focus from the focus manager.
IFocusManagerComponent
  mouseFocusEnabled : Boolean
[read-only] Gets a Boolean value that indicates whether a component that is selected by using a mouse device can receive focus.
IFocusManagerComponent
  tabEnabled : Boolean
[read-only] Gets a Boolean value that indicates whether pressing the Tab key can move focus to this component.
IFocusManagerComponent
  tabIndex : int
[read-only] Gets the order in which the component receives focus, if tabEnabledis set to true.
IFocusManagerComponent
Public Methods
 MethodDefined By
  
Draws a visual focus indicator.
IFocusManagerComponent
  
Sets focus for a component.
IFocusManagerComponent
Property Detail

focusEnabled

property
focusEnabled: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 Boolean value that indicates whether a selected component can receive focus from the focus manager.

To make a component capable of receiving focus from the focus manager, set this property to true. To make the component incapable of receiving focus, set this property to false. When focusEnabled is set to false, the focus manager ignores the component over the component's lifetime and does not monitor it for changes in the following properties: tabEnabled, tabChildren, and mouseFocusEnabled.

You can use the focusEnabled property to prevent the child component of a component that implements the IFocusManagerComponent interface from receiving focus from the focus manager. To do so, set this property to false before using the addChild() method to add the child component to the display list. Note that if you set this property to false before adding the component to the display list, the focus manager will continue to ignore the component even if you set this property to true later on.

Note: Even if you set this property to false, you can still set focus programmatically by using the setFocus() method.



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

mouseFocusEnabled

property 
mouseFocusEnabled:Boolean  [read-only]

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

Gets a Boolean value that indicates whether a component that is selected by using a mouse device can receive focus.

Set this property to true to give focus to components that are selected by using a mouse device. Set this property to false to prevent focus from being given to components that are selected by using a mouse device. If this property is set to false when a component is selected by using a mouse device, focus is transferred to the first parent component for which this property is set to true.



Implementation
    public function get mouseFocusEnabled():Boolean

tabEnabled

property 
tabEnabled:Boolean  [read-only]

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

Gets a Boolean value that indicates whether pressing the Tab key can move focus to this component. A value of true indicates that pressing the Tab key can cause focus to be moved to this component; a value of false indicates that the Tab key cannot be used to give this component focus.

Even if this value is set to false, the component can still receive focus when it is selected by a mouse device or through a call to the setFocus() method.



Implementation
    public function get tabEnabled():Boolean

tabIndex

property 
tabIndex: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 order in which the component receives focus, if tabEnabledis set to true. The tabIndex property is -1 by default, meaning that no tab index is set for the object and that the object receives focus based on z-order.

The tabIndex property can also be a non-negative integer. In this case, the objects are ordered according to their tabIndex properties, in ascending order. An object with a tabIndex value of 1 precedes an object with a tabIndex value of 2. If two objects have the same tabIndex value, the one that comes first in the default tab ordering precedes the other.

The default value is -1.



Implementation
    public function get tabIndex():int
Method Detail

drawFocus

()method
public function drawFocus(draw:Boolean):void

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

Draws a visual focus indicator.

This method is called by the focus manager when the component receives focus. The component should draw or hide a graphic that indicates that the component has focus.

Parameters

draw:Boolean — If true, draw the focus indicator, otherwise hide it.

setFocus

()method 
public function setFocus():void

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

Sets focus for a component.

This method is called by the focus manager when the component receives focus. The component may in turn set focus to an internal component.