February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

Keyboard Event

Problem

Need add event for any keys on keyboard.
Solution

We will use stage. And KeyboardEvent.Key_DOWN.
Detailed explanation

stage.addEventListener(KeyboardEvent.KEY_DOWN, ballAnimation);

function ballAnimation(e:KeyboardEvent):void

{

ball.nextFrame();

}

myBtn.addEventListener(MouseEvent.CLICK, ball2Animation);

function ball2Animation(e:MouseEvent):void

{

ball2.play();

}

index4

Source:
keyboardEvent

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>