Download Flash Lite 2.x and 3.x ActionScript Language Reference

Transcript
FLASH LITE 2.X AND 3.X ACTIONSCRIPT LANGUAGE REFERENCE
ActionScript classes
Method summary
Modifiers
Signature
Description
static
addListener(listener:
Object) : Void
Registers an object to receive onKeyDown and onKeyUp
notification.
static
getAscii() : Number
Returns the ASCII code of the last key pressed or released.
static
getCode() : Number
Returns the key code value of the last key pressed.
static
isDown(code:Number)
: Boolean
Returns true if the key specified in code is pressed; false
otherwise.
static
removeListener(listene Removes an object previously registered with
r:Object) : Boolean
Key.addListener().
Methods inherited from class Object
addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method),
isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf
(Object.isPrototypeOf method)registerClass (Object.registerClass method), toString
(Object.toString method)unwatch (Object.unwatch method), valueOf (Object.valueOf
method), watch (Object.watch method)
addListener (Key.addListener method)
public static addListener(listener:Object) : Void
Registers an object to receive onKeyDown and onKeyUp notifications. When a key is pressed or released, regardless of
the input focus, all listening objects registered with addListener() have either their onKeyDown method or their
onKeyUp method invoked. Multiple objects can listen for keyboard notifications.
Availability
Flash Lite 2.0
Parameters
listener:Object - An object with onKeyDown and onKeyUp methods.
Example
The following example creates a new listener object and defines functions for onKeyDown and onKeyUp. The last line
calls addListener() to register the listener with the Key object so that it can receive notification from the key down
and key up events.
var myListener:Object = new Object();
myListener.onKeyDown = function () {
trace ("You pressed a key.");
}
myListener.onKeyUp = function () {
trace ("You released a key.");
}
Key.addListener(myListener);
See also
getCode (Key.getCode method), isDown (Key.isDown method), onKeyDown (Key.onKeyDown event
listener), onKeyUp (Key.onKeyUp event listener), removeListener (Key.removeListener method)
Last updated 12/20/2010
315