PDA

View Full Version : Key.addListener() slow??



Ferdi
September 27th, 2005, 11:21 AM
Hey all,

I think Key.addListener reacts VERY slow. I'm trying to make my character walk, but when I push my key, the character moves one 'frame', then it pauses and after half a second he starts moving in a continues rate.

Just like when you're typing a letter and you hold a key down. First the letter appears on the screen, then it pauses, and after that you get a whole line full of that letter.

I hope I could explain it a little and you know what I'm talking about, cause I can't explain :p

Here's a piece of code I'm using with the listener:

// Keys
Key.addListener(this);
onKeyDown = function() {
switch (transport) {
case ("foot"):
Walk(Key.getCode());
break;
}
}

Does anybody have a tip for me on how to fix this, other than the onEnterFrame command?

stuartRowe
September 28th, 2005, 07:40 PM
The on enter frame is good just instead of using key listeners try this:
onClipEvent(enterFrame) {
if (Key.isDown(Key.LEFT)) {
//ACTION
}
}