Monday, December 28, 2009

How can you get input for any keyboard key in actionscript 2?

Kind of like ';Press any key to continue';. I'm using Flash MX 2004(AS2). I'm making a sort of minigame where you have to mash buttons to advance somewhere.


This is what I need:





-Accepting input from any key


-When a key is pressed, i want a bar to fill up, kind of like an experience barHow can you get input for any keyboard key in actionscript 2?
To make the movie clip accepting input from keyboards, insert the code below.





KeyListener = {};


KeyListener.onKeyDown = function() {


//Insert movie clip


}


Key.addListener(KeyListener);





Can you please elaborate on the second item? Most probably you need to use loadMovieNum() to load the bar movie clip.

No comments:

Post a Comment