Hi all,
i am having a problem with key listeners and i am hoping someone can point me in the right direction.
The problem is that i need to monitor 2 keys at the same time, the down arrow to make my object run, and the space bar to make it jump
I currently have the down key set to increase speed, which works fine
if(Key.getCode() == Key.DOWN)
{
_global.speed++;
}
Then inside the same keylistener i have the following
if(Key.getCode() == Key.SPACE)
{
_root.runner.gotoAndPlay(28);
}
so all in all the code with the listener looks like so
var KeyListener:Object = new Object();
KeyListener.onKeyUp = function() {
if(Key.getCode() == Key.SPACE)
{
_root.runner.gotoAndPlay(28);
}
if(Key.getCode() == Key.DOWN)
{
_global.speed++;
}
};
Key.addListener(KeyListener);
the problem is, if i am tapping the down key to increase the speed, i cannot press the space bar at the same time, i need to stop tapping the down key
I tried making its own keyListener but that had no change
Any ideas on how to fix this problem?
Any help would be greatly appreciated
Thanks