User Guide

688 ActionScript classes
PGUP (Key.PGUP property)
public static PGUP : Number
The key code value for the Page Up key (33).
Availability: ActionScript 1.0; Flash Player 5
Example
The following example rotates a movie clip called
car_mc when you press the Page Down or
Page Up key.
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);
removeListener (Key.removeListener method)
public static removeListener(listener:Object) : Boolean
Removes an object previously registered with Key.addListener().
Availability: ActionScript 1.0; Flash Player 6
Parameters
listener:Object - An object.
Returns
Boolean - If the listener was successfully removed, the method returns true. If the
listener was not successfully removed (for example, because the listener was not on the
Key object's listener list), the method returns
false.
Example
The following example moves a movie clip called
car_mc using the Left and Right arrow keys.
The listener is removed when you press Escape, and
car_mc no longer moves.
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.LEFT :
car_mc._x -= 10;