END (Key.END property)
public static END :
The key code value for the End key (35).
Availability: ActionScript 1.0; Flash Lite 2.0
ENTER (Key.ENTER property)
public static ENTER :
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
press the arrow keys. The
event.
onEnterFrame
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);
376
ActionScript classes
Number
Number
instance stops when you press Enter and delete the
car_mc
a constant distance (10) when you
car_mc