Packagefeathers.utils.keyboard
Classpublic class KeyToTrigger
InheritanceKeyToTrigger Inheritance KeyToEvent 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.ENTER;
    }
    
    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
 InheritedcancelKeyCode : uint
The key that will cancel the event if the key is down.
KeyToEvent
 InheritedeventType : String
The event type that will be dispatched when pressed.
KeyToEvent
 InheritedisEnabled : Boolean
May be set to false to disable event dispatching temporarily until set back to true.
KeyToEvent
 InheritedkeyCode : uint
The key that will dispatch the event, when pressed.
KeyToEvent
 InheritedkeyLocation : uint
The location of the key that will dispatch the event, when pressed.
KeyToEvent
 Inheritedtarget : IFocusDisplayObject
The target component that should be selected when a key is pressed.
KeyToEvent
Public Methods
 MethodDefined By
  
KeyToTrigger(target:IFocusDisplayObject = null, keyCode:uint)
Constructor.
KeyToTrigger
Constructor Detail
KeyToTrigger()Constructor
public function KeyToTrigger(target:IFocusDisplayObject = null, keyCode:uint)

Constructor.

Parameters
target:IFocusDisplayObject (default = null)
 
keyCode:uint (default = NaN)