Packagefeathers.core
Classpublic class FocusManager
InheritanceFocusManager Inheritance Object

Product Version : Feathers 1.1.0

Manages touch and keyboard focus.

See also

Keyboard focus management in Feathers


Public Properties
 PropertyDefined By
  focus : IFocusDisplayObject
[static] The object that currently has focus on Starling.current.stage.
FocusManager
  focusManagerFactory : Function
[static] A function that creates a focus manager.
FocusManager
Public Methods
 MethodDefined By
  
defaultFocusManagerFactory(root:DisplayObjectContainer):IFocusManager
[static] The default factory that creates a focus manager.
FocusManager
  
disableAll():void
Disables focus management on all stages where it has previously been enabled.
FocusManager
  
[static] Returns the active focus manager for the specified Starling stage.
FocusManager
  
isEnabledForStage(stage:Stage):Boolean
[static] Determines if the focus manager is enabled or disabled for the specified Starling stage.
FocusManager
  
pushFocusManager(root:DisplayObjectContainer):IFocusManager
[static] Adds a focus manager to the stack for the root argument's stage, and gives it exclusive focus.
FocusManager
  
[static] Removes the specified focus manager from the stack.
FocusManager
  
setEnabledForStage(stage:Stage, isEnabled:Boolean):void
[static] Enables or disables focus management on the specified Starling stage.
FocusManager
Property Detail
focusproperty
focus:IFocusDisplayObject

The object that currently has focus on Starling.current.stage. May return null if no object has focus.

You can call geFocusManagerForStage() to access the active IFocusManager instance for any Stage instance that isn't equal to Starling.current.stage.

In the following example, the focus is changed on the current stage:

FocusManager.focus = someObject;


Implementation
    public static function get focus():IFocusDisplayObject
    public static function set focus(value:IFocusDisplayObject):void

See also

focusManagerFactoryproperty 
public static var focusManagerFactory:Function

A function that creates a focus manager.

This function is expected to have the following signature:

function():IFocusManager

In the following example, the focus manager factory is modified:

FocusManager.focusManagerFactory = function(root:DisplayObjectContainer):IPopUpManager
{
    return new CustomFocusManager(); //a custom class that implements IFocusManager
};

See also

Method Detail
defaultFocusManagerFactory()method
public static function defaultFocusManagerFactory(root:DisplayObjectContainer):IFocusManager

The default factory that creates a focus manager.

Parameters

root:DisplayObjectContainer

Returns
IFocusManager

See also

disableAll()method 
public function disableAll():void

Disables focus management on all stages where it has previously been enabled.

getFocusManagerForStage()method 
public static function getFocusManagerForStage(stage:Stage):IFocusManager

Returns the active focus manager for the specified Starling stage. May return null if focus management has not been enabled for the specified stage.

Parameters

stage:Stage

Returns
IFocusManager

See also

isEnabledForStage()method 
public static function isEnabledForStage(stage:Stage):Boolean

Determines if the focus manager is enabled or disabled for the specified Starling stage.

Parameters

stage:Stage

Returns
Boolean

See also

pushFocusManager()method 
public static function pushFocusManager(root:DisplayObjectContainer):IFocusManager

Adds a focus manager to the stack for the root argument's stage, and gives it exclusive focus. If focus management has not been enabled for the root's stage, then calling this function will throw a runtime error.

Parameters

root:DisplayObjectContainer

Returns
IFocusManager
removeFocusManager()method 
public static function removeFocusManager(manager:IFocusManager):void

Removes the specified focus manager from the stack. If it was the top-most focus manager, the next top-most focus manager is enabled.

Parameters

manager:IFocusManager

setEnabledForStage()method 
public static function setEnabledForStage(stage:Stage, isEnabled:Boolean):void

Enables or disables focus management on the specified Starling stage. For mobile apps, the focus manager should generally remain disabled. For desktop apps, it is recommended to enable the focus manager to support keyboard navigation.

In the following example, focus management is enabled:

FocusManager.setEnabledForStage(stage, true);

Parameters

stage:Stage
 
isEnabled:Boolean

See also