User Guide
Key.isDown() 305
this.attachMovie("car_id", "car_mc", this.getNextHighestDepth(), {_x:0,
_y:0});
car_mc.onPress = function() {
this.startDrag();
};
car_mc.onRelease = function() {
this.stopDrag();
};
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.HOME)) {
car_mc._x = 0;
car_mc._y = 0;
}
};
Key.addListener(keyListener);
Key.INSERT
Availability
Flash Player 5.
Usage
Key.INSERT:Number
Description
Property; constant associated with the key code value for the Insert key (45).
Example
The following example creates a new listener object and defines a function for onKeyDown. The
last line uses
addListener() to register the listener with the Key object so that it can receive
notification from the key down event and write information to the log file.
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.INSERT)) {
trace("You pressed the Insert key.");
}
};
Key.addListener(keyListener);
Key.isDown()
Availability
Flash Player 5.
Usage
Key.isDown(keycode:Number) : Boolean