Been a while, greetings,
AS3 the key listener is odd . It fires off one event,waits an interval, then proceeds to fire off events every few milliseconds instead of instantly. Why Adobe did it this way I can't imagine but anyway- it's making it damn hard to code games that require tight arcade controls.
Does anyone know a hack for this?
I know you could do say set a variable when the listeners are first fired :
Key_downListener-
key_up=true;
Key_upListener-
key_down=false;
This will work fine for say, moving a character in 8 directions.
But what I need is to time between the same key being pressed twice:
keys[ev.keyCode].now = getTimer() - keys[ev.keyCode].then;
keys[ev.keyCode].then = getTimer();
Imagine a combo like situation in a fighting game. tap tap tap, if the key registers a 0.05 second pause it combo's- if between it's 1second, don't combo and only play the first attack in the combo link array.
Impossible with the AS3 Listener, it registers unevenly if you hold the key down, therefore the timer won't work properly. the code in the EVENT_FRAME has gone through 12 or so passes after the first pause.
Anyway, not sure if anyone grasps what I'm on about, it's hard to explain and I'm sure I'm not making sense here.
Thanks if you can help.
Kris
