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.

Example<br />

In the following example, if the String.fromCharCode(Key.getAscii()) parameter<br />

evaluates to A, the trace() statement that follows case "A" executes; if the parameter<br />

evaluates to a, the trace() statement that follows case "a"executes; <strong>and</strong> so on. If no case<br />

expression matches the String.fromCharCode(Key.getAscii()) parameter, the trace()<br />

statement that follows the default keyword executes.<br />

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

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

switch (String.fromCharCode(Key.getAscii())) {<br />

case "A" :<br />

trace("you pressed A");<br />

break;<br />

case "a" :<br />

trace("you pressed a");<br />

break;<br />

case "E" :<br />

case "e" :<br />

trace("you pressed E or e");<br />

break;<br />

case "I" :<br />

case "i" :<br />

trace("you pressed I or i");<br />

break;<br />

default :<br />

trace("you pressed some other key");<br />

break;<br />

}<br />

};<br />

Key.addListener(listenerObj);<br />

See also<br />

=== strict equality operator<br />

throw statement<br />

throw expression<br />

Generates, or throws, an error that can be h<strong>and</strong>led, or caught, by a catch{} code block. If an<br />

exception is not caught by a catch block, the string representation of the thrown value is sent<br />

to the Output panel.<br />

Typically, you throw instances of the Error class or its subclasses (see the Example section).<br />

Parameters<br />

expression:Object - An ActionScript expression or object.<br />

200 ActionScript language elements

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

Saved successfully!

Ooh no, something went wrong!