View Full Version : assistance required

Shas'O kias
03-26-2012, 08:27 AM
hello, i am new to coding however I am currently creating a small two player RST game. because its a 2 player game i was thinking of using the keypad as a mouse, the ownly problem this raises is when it comes to buttons. so my question is can i use a movie clip to make a button work?

any help would be much appriciated

03-28-2012, 02:48 AM
hi there,

I'm hoping that you mean you would like to control a movieclip with a keyboard button instead of the other way around.

In this case, what you need is a keyboard listener on your movieclip.

first you add the listener and pass in the name of the handler you will write

addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);

then, you write the handler and you're good to go.

function keyDownHandler(event:KeyboardEvent):void
if(event.keycode == 86) //looking for a 'v' button to be pressed

//do awesome stuff here!!