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.

DOWN (Key.DOWN property)<br />

public static DOWN : Number<br />

The key code value for the Down Arrow key (40).<br />

Example<br />

The following example moves a movie clip called car_mc a constant distance (10) when you<br />

press the arrow keys. A sound plays when you press the Spacebar. Give a sound in the library a<br />

linkage identifier of horn_id for this example.<br />

var DISTANCE:Number = 10;<br />

var horn_sound:Sound = new Sound();<br />

horn_sound.attachSound("horn_id");<br />

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

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

switch (Key.getCode()) {<br />

case Key.SPACE :<br />

horn_sound.start();<br />

break;<br />

case Key.LEFT :<br />

car_mc._x -= DISTANCE;<br />

break;<br />

case Key.UP :<br />

car_mc._y -= DISTANCE;<br />

break;<br />

case Key.RIGHT :<br />

car_mc._x += DISTANCE;<br />

break;<br />

case Key.DOWN :<br />

car_mc._y += DISTANCE;<br />

break;<br />

}<br />

};<br />

Key.addListener(keyListener_obj);<br />

END (Key.END property)<br />

public static END : Number<br />

The key code value for the End key (35).<br />

ENTER (Key.ENTER property)<br />

public static ENTER : Number<br />

The key code value for the Enter key (13)..<br />

Key 349

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

Saved successfully!

Ooh no, something went wrong!