Flash KeyUp/KeyDown messages repeat and thus incorrect

From dis-Emi-A

Jump to: navigation, search

Flash 9 doesn't have any way to reliably determine if a given key is currently down.

Reason taken from the KeyboardManager.hx in the haXe Library.

Hmm, the messages in Flash are retarded, they send up/down though they are tied to CHARACTER events and not keys themselves, thus when a user pressed any button down (just down) immediately a down then up is sent, then the repeated DOWN message is sent... Quite braindead for use in games.

The sequence seems to be:

  1. KEYDOWN
  2. KEYUP (and finish if no longer pressed)
  3. KEYDOWN (if still being pressed)
  4. KEYDOWN x N
  5. KEYUP (when released)

It is the first KEYUP that could be a problem.. On my system there is a good 100ms between the first KEYUP and the next KEYDOWN, that would certainly cause control problems in games.

Hmm, on firefox testing it is even worse, there is a continuous alternation between KeyUp and KeyDown messages.

Personal tools