EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - SHIFT (Key.shift Property); SPACE (Key.space Property)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
690 ActionScript classes
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
car_mc when you press Shift.
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
car_mc a constant distance (10) when you
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
horn_id.
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;

Table of Contents

Related product manuals