03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The key code value for the Caps Lock key (20).<br />

CONTROL (Key.CONTROL property)<br />

public static CONTROL : Number<br />

The key code value for the Control key (17).<br />

DELETEKEY (Key.DELETEKEY property)<br />

public static DELETEKEY : Number<br />

The key code value for the Delete key (46).<br />

Example<br />

The following example lets you draw lines with the mouse pointer using the Drawing API <strong>and</strong><br />

listener objects. Press the Backspace or Delete key to remove the lines that you draw.<br />

this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());<br />

var mouseListener:Object = new Object();<br />

mouseListener.onMouseDown = function() {<br />

this.drawing = true;<br />

canvas_mc.moveTo(_xmouse, _ymouse);<br />

canvas_mc.lineStyle(3, 0x99CC00, 100);<br />

};<br />

mouseListener.onMouseUp = function() {<br />

this.drawing = false;<br />

};<br />

mouseListener.onMouseMove = function() {<br />

if (this.drawing) {<br />

canvas_mc.lineTo(_xmouse, _ymouse);<br />

}<br />

updateAfterEvent();<br />

};<br />

Mouse.addListener(mouseListener);<br />

//<br />

var keyListener:Object = new Object();<br />

keyListener.onKeyDown = function() {<br />

if (Key.isDown(Key.DELETEKEY) || Key.isDown(Key.BACKSPACE)) {<br />

canvas_mc.clear();<br />

}<br />

};<br />

Key.addListener(keyListener);<br />

When using this example, make sure that you select Control > Disable Keyboard Shortcuts in<br />

the test environment.<br />

348 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!