I was wondering if anyone had a similiar problem I have ?
I don’t have the code at hand, but it’s not too hard to explain.
The setup is as follows :
I have a listener for keys, and a switch statement that catches the key events. If I press ‘left’ for example, a variable moveLeft becomes true. If I release the left button, moveLeft will become false.
This seems to work, until I do the following: Press and hold left, press and hold any other button aswell. If I release the buttons, it will not register the keyUp event for some reason. I know the code worked in Flash MX 2004 because I literally copy-pasted it :cross-eye
For now I work with Key.isDown(Key.LEFT), but that looks just plain ugly I.m.h.o…
I was about to, but I have it on an external HDD that I don’t have here It’s basically 1 on 1 with the description above though, I thought that was enough info, but I’ll post code tonight
Thats a big reason that I stopped using keyListeners and stuff.
The way I do it now (and this mightturn out to be worse but it works great for me) is put an “if (Key.isDown(87))” In an "onClipEvent(enterFrame) " in a movie clip. Like I said, maybe this is not the best way or a coiincedance, but it solved a bunch of problems I had using keyListener
so:
onClipEvent(enterFrame) {
if (Key.isDown(87)) //w
_y=-5;
if (Key.isDown(65)) //a
_x=-5;
if (Key.isDown(83)) //s
_y=5;
if (Key.isDown(68)) //d
_x=5;
}
when put in a movie clip would make the charecter move around using WASD