EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - END (Key.end Property); ENTER (Key.enter Property)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 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...
376 ActionScript classes
END (Key.END property)
public static END : Number
The key code value for the End key (35).
Availability: ActionScript 1.0; Flash Lite 2.0
ENTER (Key.ENTER property)
public static ENTER : Number
The key code value for the Enter key (13)..
Availability: ActionScript 1.0; Flash Lite 2.0
Example
The following example moves a movie clip called
car_mc a constant distance (10) when you
press the arrow keys. The
car_mc instance stops when you press Enter and delete the
onEnterFrame event.
var DISTANCE:Number = 5;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.LEFT :
car_mc.onEnterFrame = function() {
this._x -= DISTANCE;
};
break;
case Key.UP :
car_mc.onEnterFrame = function() {
this._y -= DISTANCE;
};
break;
case Key.RIGHT :
car_mc.onEnterFrame = function() {
this._x += DISTANCE;
};
break;
case Key.DOWN :
car_mc.onEnterFrame = function() {
this._y += DISTANCE;
};
break;
case Key.ENTER :
delete car_mc.onEnterFrame;
break;
}
};
Key.addListener(keyListener);

Table of Contents

Related product manuals