Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Key > DELETEKEY (Key.DELETEKEY property) | |||
public static DELETEKEY : Number
The key code value for the Delete key (46).
Availability: ActionScript 1.0; Flash Player 5
The following example lets you draw lines with the mouse pointer using the Drawing API and listener objects. Press the Backspace or Delete key to remove the lines that you draw.
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.drawing = true;
canvas_mc.moveTo(_xmouse, _ymouse);
canvas_mc.lineStyle(3, 0x99CC00, 100);
};
mouseListener.onMouseUp = function() {
this.drawing = false;
};
mouseListener.onMouseMove = function() {
if (this.drawing) {
canvas_mc.lineTo(_xmouse, _ymouse);
}
updateAfterEvent();
};
Mouse.addListener(mouseListener);
//
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.DELETEKEY) || Key.isDown(Key.BACKSPACE)) {
canvas_mc.clear();
}
};
Key.addListener(keyListener);
When you use this example, be sure to select Control > Disable Keyboard Shortcuts in the test environment.
The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001753.html