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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INSERT (Key.INSERT property)<br />

public static INSERT : Number<br />

The key code value for the Insert key (45).<br />

Example<br />

The following example creates a new listener object <strong>and</strong> defines a function for onKeyDown.<br />

The last line uses addListener() to register the listener with the Key object so that it can<br />

receive notification from the key down event <strong>and</strong> display information in the Output panel.<br />

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

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

if (Key.isDown(Key.INSERT)) {<br />

trace("You pressed the Insert key.");<br />

}<br />

};<br />

Key.addListener(keyListener);<br />

isDown (Key.isDown method)<br />

public static isDown(code:Number) : Boolean<br />

Returns true if the key specified in code is pressed; false otherwise.<br />

Parameters<br />

code:Number - The key code value assigned to a specific key or a Key class property associated<br />

with a specific key.<br />

Returns<br />

Boolean - The value true if the key specified in code is pressed; false otherwise.<br />

Example<br />

The following script lets the user control the location of a movie clip (car_mc):<br />

car_mc.onEnterFrame = function() {<br />

if (Key.isDown(Key.RIGHT)) {<br />

this._x += 10;<br />

} else if (Key.isDown(Key.LEFT)) {<br />

this._x -= 10;<br />

}<br />

};<br />

LEFT (Key.LEFT property)<br />

public static LEFT : Number<br />

354 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!