Packagegs.util
Classpublic class KeyHandler

The KeyHandler class is a shortcut to handle keyboard events.

Examples are in the guttershark repository.

Supported Key Shortcuts for Key Sequences



Public Properties
 PropertyDefined by
  autoTarget : DisplayObject
[write-only] A display object that toggles enabled / disabled when it's added / removed from the stage.
KeyHandler
  enabled : Boolean
Whether or not this key handler should fire.
KeyHandler
Public Methods
 MethodDefined by
  
KeyHandler(shortcut:String, callback:Function)
Constructor for KeyHandler instances.
KeyHandler
  
disable(id:String):void
[static] Disable a key handler.
KeyHandler
  
dispose():void
Dispose of this key handler.
KeyHandler
  
enable(id:String):void
[static] Enable a key handler.
KeyHandler
  
get(id:String):KeyHandler
[static] Get a key handler instance.
KeyHandler
  
set(id:String, kh:KeyHandler):void
[static] Set a key handler instance.
KeyHandler
  
unset(id:String):void
[static] Unset (delete) a key handler.
KeyHandler
Property detail
autoTargetproperty
autoTarget:DisplayObject  [write-only]

A display object that toggles enabled / disabled when it's added / removed from the stage.

Implementation
    public function set autoTarget(value:DisplayObject):void
enabledproperty 
enabled:Boolean  [read-write]

Whether or not this key handler should fire.

Implementation
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void
Constructor detail
KeyHandler()constructor
public function KeyHandler(shortcut:String, callback:Function)

Constructor for KeyHandler instances.

Parameters
shortcut:String — The key shortcut to install.
 
callback:Function — A callback function to execute when the key sequence is pressed.
Method detail
disable()method
public static function disable(id:String):void

Disable a key handler.

Parameters
id:String — The key handler id.
dispose()method 
public function dispose():void

Dispose of this key handler.

enable()method 
public static function enable(id:String):void

Enable a key handler.

Parameters
id:String — The key handler id.
get()method 
public static function get(id:String):KeyHandler

Get a key handler instance.

Parameters
id:String — The key handler id.

Returns
KeyHandler
set()method 
public static function set(id:String, kh:KeyHandler):void

Set a key handler instance.

Parameters
id:String — An id for the key handler.
 
kh:KeyHandler — The key handler.
unset()method 
public static function unset(id:String):void

Unset (delete) a key handler.

Parameters
id:String — The key handler id.