Right (Key.right Property) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Example
The following example moves a movie clip called
The listener is removed when you press Escape, and
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.LEFT :
car_mc._x -= 10;
break;
case Key.RIGHT :
car_mc._x += 10;
break;
case Key.ESCAPE :
Key.removeListener(keyListener);
}
};
Key.addListener(keyListener);

RIGHT (Key.RIGHT property)

public static RIGHT :
The key code value for the Right Arrow key (39).
Availability: ActionScript 1.0; Flash Lite 2.0
Example
The following example moves a movie clip called
press 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;
case Key.LEFT :
car_mc._x -= DISTANCE;
break;
case Key.UP :
car_mc._y -= DISTANCE;
386
ActionScript classes
Number
for this example.
using the Left and Right arrow keys.
car_mc
no longer moves.
car_mc
a constant distance (10) when you
car_mc

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Table of Contents