Shift (Key.shift Property); Space (Key.space Property) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

SHIFT (Key.SHIFT property)

public static SHIFT : Number
The key code value for the Shift key (16).
Availability: ActionScript 1.0; Flash Player 5
Example
The following example scales
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.SHIFT)) {
car_mc._xscale = 2;
car_mc._yscale = 2;
} else if (Key.isDown(Key.CONTROL)) {
car_mc._xscale /= 2;
car_mc._yscale /= 2;
}
};
Key.addListener(keyListener);

SPACE (Key.SPACE property)

public static SPACE : Number
The key code value for the Spacebar (32).
Availability: ActionScript 1.0; Flash Player 5
Example
The following example moves a movie clip called
press an arrow key. A sound plays when you press the Spacebar. For this example, give a sound
in the library a linkage identifier of
var DISTANCE:Number = 10;
var horn_sound:Sound = new Sound();
horn_sound.attachSound("horn_id");
var keyListener_obj:Object = new Object();
keyListener_obj.onKeyDown = function() {
switch (Key.getCode()) {
case Key.SPACE :
horn_sound.start();
break;
case Key.LEFT :
car_mc._x -= DISTANCE;
break;
case Key.UP :
car_mc._y -= DISTANCE;
690
ActionScript classes
when you press Shift.
car_mc
car_mc
.
horn_id
a constant distance (10) when you

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents