Key.enter - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

Key.ENTER

Availability
Flash Player 5.
Usage
Key.ENTER:Number
Description
Property; constant associated with the key code value for the Enter key (13).
Example
The following example moves a movie clip called
the arrow keys. The
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);
When using this example, make sure that you select Control > Disable Keyboard Shortcuts in the
test environment.
instance stops when you press Enter and delete the
car_mc
a constant distance (10) when you press
car_mc
onEnterFrame
Key.ENTER
351

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash mx

Table of Contents