Packagefeathers.utils.keyboard
Classpublic class KeyToEvent
InheritanceKeyToEvent Inheritance Object
Subclasses KeyToTrigger

Product Version : Feathers 3.4.0

Dispatches an event 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._keyToEvent = new KeyToEvent(this, Event.TRIGGERED);
        this._keyToEvent.keyCode = Keyboard.SPACE;
    }
    
    private var _keyToEvent:KeyToEvent;
// ...

See also

feathers.utils.keyboard.KeyToTrigger
feathers.utils.keyboard.KeyToSelect


Public Properties
 PropertyDefined By
  cancelKeyCode : uint
The key that will cancel the event if the key is down.
KeyToEvent
  eventType : String
The event type that will be dispatched when pressed.
KeyToEvent
  isEnabled : Boolean
May be set to false to disable event dispatching temporarily until set back to true.
KeyToEvent
  keyCode : uint
The key that will dispatch the event, when pressed.
KeyToEvent
  keyLocation : uint
The location of the key that will dispatch the event, when pressed.
KeyToEvent
  target : IFocusDisplayObject
The target component that should be selected when a key is pressed.
KeyToEvent
Public Methods
 MethodDefined By
  
KeyToEvent(target:IFocusDisplayObject = null, keyCode:uint, eventType:String = null)
Constructor.
KeyToEvent
Property Detail
cancelKeyCodeproperty
cancelKeyCode:uint

The key that will cancel the event 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
eventTypeproperty 
eventType:String

The event type that will be dispatched when pressed.


Implementation
    public function get eventType():String
    public function set eventType(value:String):void
isEnabledproperty 
isEnabled:Boolean

May be set to false to disable event dispatching 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 dispatch the event, when pressed.

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


Implementation
    public function get keyCode():uint
    public function set keyCode(value:uint):void
keyLocationproperty 
keyLocation:uint

The location of the key that will dispatch the event, when pressed. If uint.MAX_VALUE, then any key location is allowed.

The default value is uint.MAX_VALUE.


Implementation
    public function get keyLocation():uint
    public function set keyLocation(value:uint):void

See also

flash.ui.KeyLocation
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
KeyToEvent()Constructor
public function KeyToEvent(target:IFocusDisplayObject = null, keyCode:uint, eventType:String = null)

Constructor.

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