It would be not too hard to write a class that listesn to the keyboard, and
when an onKeyDown event is triggered, it reads the key and adds the keycode
to an array.

I can't speak for Flash in this regard, but I'm willing to bet it would behave similarly to Director and that this method would be unreliable. (I think it's an OS-level problem, in fact). You'd experience several problems that would cause your key manage to go out of synch with the key states. Most obviously, if the window loses focus, it doesn't receive the key events, so it's quite possible to get a keyDown event and not a keyUp (and this isn't as rare as you might think: I often have problems when my anti-virus scan finishes and pulls me out of the window I'm working in). Also, there are problems with keyUp events when multiple keys are pressed. In Director, at least on Windows, if you press the A key and then the B key, then release the A key, you get a keyUp event for B, not A. So writing a key manager without any way to poll the state of individual keys is very limited.

Danny


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to