Packagefeathers.utils.keyboard
Classpublic class KeyToTrigger
InheritanceKeyToTrigger Inheritance Object

Product Version : Feathers 3.0.0

Dispatches Event.TRIGGERED from the target when a key is pressed and released and the target has focus. Conveniently handles all KeyboardEvent listeners automatically.

In the following example, a custom item renderer will be triggered when a key is pressed and released:

public class CustomComponent extends FeathersControl implements IFocusDisplayObject
{
    public function CustomComponent()
    {
        super();
        this._keyToTrigger = new KeyToTrigger(this);
        this._keyToTrigger.keyCode = Keyboard.SPACE;
    }
    
    private var _keyToTrigger:KeyToTrigger;
// ...

Note: When combined with a KeyToSelect instance, the KeyToTrigger instance should be created first because Event.TRIGGERED should be dispatched before Event.CHANGE.

See also

starling.events.Event.TRIGGERED
feathers.utils.keyboard.KeyToSelect
feathers.utils.touch.TapToTrigger


Public Properties
 PropertyDefined By
  cancelKeyCode : uint
The key that will cancel the trigger if the key is down.
KeyToTrigger
  isEnabled : Boolean
May be set to false to disable selection temporarily until set back to true.
KeyToTrigger
  keyCode : uint
The key that will trigger the target, when pressed.
KeyToTrigger
  target : IFocusDisplayObject
The target component that should be selected when a key is pressed.
KeyToTrigger
Public Methods
 MethodDefined By
  
Constructor.
KeyToTrigger
Property Detail
cancelKeyCodeproperty
cancelKeyCode:uint

The key that will cancel the trigger if the key is down.

The default value is flash.ui.Keyboard.ESCAPE.


Implementation
    public function get cancelKeyCode():uint
    public function set cancelKeyCode(value:uint):void
isEnabledproperty 
isEnabled:Boolean

May be set to false to disable selection temporarily until set back to true.


Implementation
    public function get isEnabled():Boolean
    public function set isEnabled(value:Boolean):void
keyCodeproperty 
keyCode:uint

The key that will trigger the target, when pressed.

The default value is flash.ui.Keyboard.SPACE.


Implementation
    public function get keyCode():uint
    public function set keyCode(value:uint):void
targetproperty 
target:IFocusDisplayObject

The target component that should be selected when a key is pressed.


Implementation
    public function get target():IFocusDisplayObject
    public function set target(value:IFocusDisplayObject):void
Constructor Detail
KeyToTrigger()Constructor
public function KeyToTrigger(target:IFocusDisplayObject = null)

Constructor.

Parameters
target:IFocusDisplayObject (default = null)