MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 296

Actionscript language reference
Table of Contents

Advertisement

Property
Key.PGUP
Key.RIGHT
Key.SHIFT
Key.SPACE
Key.TAB
Key.UP
Listener summary for the Key class
Method
Key.onKeyDown
Key.onKeyUp
Key.addListener()
Availability
Flash Player 6.
Usage
Key.addListener (newListener:Object) : Void
Parameters
newListener
Returns
Nothing.
Description
Method; registers an object to receive
pressed or released, regardless of the input focus, all listening objects registered with
addListener()
objects can listen for keyboard notifications. If the listener
change occurs.
Example
The following example creates a new listener object and defines a function for
. The last line uses
onKeyUp
can receive notification from the key down and key up events.
var myListener:Object = new Object();
myListener.onKeyDown = function () {
trace ("You pressed a key.");
}
296
Chapter 6: ActionScript Core Classes
Description
The key code value for the Page Up key.
The key code value for the Right Arrow key.
The key code value for the Shift key.
The key code value for the Spacebar.
The key code value for the Tab key.
The key code value for the Up Arrow key.
Description
Notified when a key is pressed.
Notified when a key is released.
An object with methods
onKeyDown
have either their
onKeyDown
addListener()
and
onKeyDown
onKeyUp
and
onKeyUp
method or
onKeyUp
newListener
to register the listener with the Key object so that it
Key code
33
39
16
32
9
38
.
notification. When a key is
method invoked. Multiple
is already registered, no
onKeyDown
and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents