Key.SHIFT
Availability
Flash Player 5.
Usage
Key.SHIFT:Number
Description
Property; constant associated with the key code value for the Shift key (16).
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);
Key.SPACE
Availability
Flash Player 5.
Usage
Key.SPACE:Number
Description
Property; constant associated with the key code value for the Spacebar (32).
Example
The following example moves a movie clip called
the arrow keys. A sound plays when you press the Spacebar. 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;
312
Chapter 6: ActionScript Core Classes
when you press Shift.
car_mc
for this example.
a constant distance (10) when you press
car_mc
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers