Description
Listener; notified when a key is released. To use
can then define a function for
Key object, as shown in the following example:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
trace("DOWN -> Code: "+Key.getCode()+"\tACSII: "+Key.getAscii()+"\tKey:
"+chr(Key.getAscii()));
};
keyListener.onKeyUp = function() {
trace("UP -> Code: "+Key.getCode()+"\tACSII: "+Key.getAscii()+"\tKey:
"+chr(Key.getAscii()));
};
Key.addListener(keyListener);
Listeners enable different pieces of code to cooperate because multiple listeners can receive
notification about a single event.
See also
Key.addListener()
Key.PGDN
Availability
Flash Player 5.
Usage
Key.PGDN:Number
Description
Property; constant associated with the key code value for the Page Down key (34).
Example
The following example rotates a movie clip called
Page Up keys.
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.PGDN)) {
car_mc._rotation += 5;
} else if (Key.isDown(Key.PGUP)) {
car_mc._rotation -= 5;
}
};
Key.addListener(keyListener);
onKeyUp,
and use
onKeyUp
addListener()
car_mc
you must create a listener object. You
to register the listener with the
when you press the Page Down and
Key.PGDN
309
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?