MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 409

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Property
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)
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.
myListener = new Object();
myListener.onKeyDown = function () {
trace ("You pressed a key.");
}
myListener.onKeyUp = function () {
trace ("You released a key.");
}
Key.addListener(myListener);
Description
Constant associated with the key code value for the Right Arrow key (39).
Constant associated with the key code value for the Shift key (16).
Constant associated with the key code value for the Spacebar (32).
Constant associated with the key code value for the Tab key (9).
Constant associated with the key code value for the Up Arrow key (38).
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
.
notification. When a key is
method invoked. Multiple
is already registered, no
onKeyDown
Key.addListener()
and
409

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents