AS3.0 KeyboardEvent WooDoo

Friday, October 10th, 2008

WTF? I don’t know what’s wrong, and if this is a bug or anything, but I came across interesting issue. Let me first tell, that it seems it’s bug on Windows, or maybe just my Windows :) really do not know, I need you to help me. I need your test to let me find out what is the problem, because it seems that it works on my friend’ Mac. I’ve tried Flash Player 9.0.115 and 9.0.124.

Problems is in getting KeyboardEvent.KEY_DOWN for multiple keys. I’m working on some sport game in AS3 and I need to check for key kombination like Right Arrow + Down Arrow + Space, but it’s never fired up on my Windows. I thought it’s some logic what’s wrong in my game, so I’ve created simple pure AS3 example and there is problem as well. There is strange Woodoo, some combinations work, some do not :) I really do not see the logic. Here is example, just press and multiple Arrows and Space in same time. You can try simple key strokes, you will see red keys when key is pressed (KeyboardEvent.KEY_DOWN was received). When you release key, it just come back to its grey state. So please play and let me know your results. I need to know OS, Player version (included in example) and if you have same problems as me, or what does not work for you. (Click to movie, to gain focus)

And here is my Woodoo, I simply can not do this combinations

  • SPACE + LEFT ARROW + UP ARROW
  • SPACE + LEFT ARROW + DOWN ARROW
  • SPACE + RIGHT ARROW + DOWN ARROW
  • SPACE + RIGHT ARROW + UP ARROW – ATTENTION!!! I can do this combination

Next example, press and hold SPACE + LEFT ARROW, now press DOWN ARROW, KEY_DOWN event is not fired, just release SPACE while DONW ARROW is still pressed, and now KEY_DOWN event for DOWN ARROW is fired up. WTF ?

Please can you confirm my Woodoo. I need to find out, if this is Flash Player Bug, or maybe something else? Please post your result to comments. Thank you.

If you want stay updated with result or similar tips & tricks, or any other stuff I think it’s interested and important, please consider subscribe to my Franto.com Tips & Tricks.

tagged under:

ABOUT THIS AUTHOR

Get a Trackback link

27 Comments


  1. sakri
    Visit Site
    October 10th, 2008

    on windows xp WIN 9,0,115,0

    All the combos work… except for SPACE + LEFT ARROW + UP ARROW… wtf indeed?!


  2. lharp
    Visit Site
    October 10th, 2008

    So this seems to be a bug only on Windows.
    Everything works fine on my Mac in both FP 9.0.124 Standalone and Plugin.
    So you found some bug?
    What about FP 10?


  3. daniel.sedlacek
    Visit Site
    October 10th, 2008

    Hi Franto, that’s a real woodoo, it fails for me too but in a different combination.

    SPACE + LEFT ARROW + UP ARROW – OK
    SPACE + LEFT ARROW + DOWN ARROW – NOT OK
    SPACE + RIGHT ARROW + DOWN ARROW – OK
    SPACE + RIGHT ARROW + UP ARROW – NOT OK

    Player 9,0,124,0
    System WinXP Pro SP2


  4. Piergiorgio Niero
    Visit Site
    October 10th, 2008

    fp 10.0.12 osx 10.5
    yes to all BUT no way on opposite keys


  5. Jacob Buck
    Visit Site
    October 10th, 2008

    I can do these:
    SPACE + LEFT ARROW + DOWN ARROW
    SPACE + RIGHT ARROW + UP ARROW

    All other work as they should.


  6. mond
    Visit Site
    October 10th, 2008

    vista, fp 9,0,124,0
    for me these do NOT work:
    SPACE + LEFT ARROW + UP ARROW
    SPACE + RIGHT ARROW + DOWN ARROW

    others work fine


  7. Roman
    Visit Site
    October 10th, 2008

    All combinations work fine (Win Vista Business, flash player 9,0,124,0 installed, notebook Lenovo ThinkPad R61)


  8. Dirss
    Visit Site
    October 10th, 2008

    hi!
    This a problem that I had too in AS2 and that I have always in AS3 too.
    Some combinations doesn’t want to work.. I never knew why..
    In my case SPACE+LEFT+UP doesn’t works.

    Regulary in my projects I have some key shorcuts to debug or help XML updates and thoses shortcuts work fine on my computer but sometimes they don’t. Even on mac (of what i could see it’s even worst on mac >_<.. but I just might had no luck)..

    I think the origin of this problem has no report to flash but more to the OS…
    I’ve never found any solution :/

    I think the best solution is to let the ability the the player to configure the keys ;)

    Good Luck!


  9. _nec
    Visit Site
    October 10th, 2008

    all combinations are OK at here, even 4keys as
    SPACE + LEFT + DOWN + RIGHT
    but for examlpe
    SPACE + LEFT + UP + RIGHT does not

    xp sp2
    firefox / chrome / ie6 9,0,124,0


  10. Franto
    Visit Site
    October 10th, 2008

    Guys thank you for your fast feedback, at least I know, I’m not alone with that problems, and it really seems, it’s OS specific. Still, if there are others with Mac and Linux, can you post your results as well? to be sure, it’s just Windows problems. As Dirss mentioned, it seems it could be Mac problem as well, till now I just have 1 Mac results, and it works


  11. mattjpoole
    Visit Site
    October 10th, 2008

    all combinations work fine for me (including opposite directions, with and without space).

    Win XP SP3, Firefox 3.0.3, FP 9.0.115.0


  12. Mario
    Visit Site
    October 10th, 2008

    Only this combination is NOT working for me:

    SPACE + LEFT ARROW + UP ARROW

    Windows Vista
    FireFox 3.0.3
    FP 9.0.124

    Cheers.


  13. Franto
    Visit Site
    October 10th, 2008

    Hmmm, so there are even correct ones :)


  14. Shimray
    Visit Site
    October 11th, 2008

    Everything works fine. OSX 10.5.5 / Safari 3.1.2 / Flash 9.0.124.0 debug


  15. Flo
    Visit Site
    October 11th, 2008

    # SPACE + LEFT ARROW + UP ARROW => Doesn’t work
    # SPACE + LEFT ARROW + DOWN ARROW => Work fine
    # SPACE + RIGHT ARROW + DOWN ARROW => Work fine
    # SPACE + RIGHT ARROW + UP ARROW => Work fine

    (WinXP SP2, flash player 9,0,124,0 installed, notebook Lenovo ThinkPad R61)


  16. sHTiF
    Visit Site
    October 12th, 2008

    Yep this seems to be Win only problem, had the same problem when i was creating a simple game in VC++, seems to me like it has something to do with win keyboard buffer so this is not Flash related. In VC++ i solved it by handling keyboard through DirectInput library but i don’t see a simple solution in Flash. :/


  17. sHTiF
    Visit Site
    October 12th, 2008

    Oh i forgot, in Flash Player 10 i can do all the combinations without a problem, but still dont think its Flash related.


  18. Iain
    Visit Site
    October 13th, 2008

    All combinations work for me, but you will find that different combinations work for different people. This is most likely because of the HARDWARE of the keyboard you are using, not the OS. Try swapping out your keyboard for another one.


  19. Franto
    Visit Site
    October 13th, 2008

    Hmm Iain, i thought about Keyboard hardware as well, it can be issue :) I don’t have 2 keyboards here, but if anyone have, can you test it please?

    Thank you

    And thanks Iain for hint :)


  20. judah
    Visit Site
    November 30th, 2008

    All combinations work on MacOSX, Flash Player 10 and Firefox 3.0.4.

    I would say give your users the option to use a joystick or gamepad but oops Flash Player doesn’t have it yet. Flash Player is only version 10. :P


  21. Ben
    Visit Site
    December 10th, 2008

    if i hold up, i cant press left.
    if i hold left, i cant press up.

    all other combinations work fine – never had these problems with as2.

    Firefox 3.0.4
    Flash Player WIN 10,0,12,36
    Windows XP SP.3
    Dell Latitude E6500


  22. Propecia
    Visit Site
    January 29th, 2009

    Rocking all the latest updates here between MacOSX, FF, and Flash, and I’ve no problems at all


  23. Paul
    Visit Site
    February 4th, 2009

    Perhaps this is why some game developers stick with the WASD keys and space as these seem to work fine. I have just tried it in my code in place of the arrow keys.


  24. corfix
    Visit Site
    February 5th, 2009

    This is a hardware problem. Maybe not a real problem, but architecture solution which occured long, long time ago. Engineers with limited resources of memory had to allocate all 1 key and 2 keys events. With resources left they tried to map as much 3 keys combinations as possible (thus some scenarious works, some not).
    Nowadays when you buy a keyboard you have something like 50% chance to get a piece with new, redesigned architecture which can interprete all 3 keys combinations (and even 4 keys!).


  25. Third Cousin
    Visit Site
    February 5th, 2009

    I ran across the same problem in a game I’m building in AS2 on a PC. corfix explanation seems legit. I tested the same game on the same computer and the only thing I did was change keyboards. It worked on the third keyboard I tried. It was a Logitech. The funny thing is the first keyboard I tested was also a Logitech but obviously it was a different model. I also found that different keyboards gave different results on detecting certain 3 key combinations. So it seems the solution would be avoiding 3 key combinations all together, sadly.


  26. Yummi
    Visit Site
    March 1st, 2009

    that’s a hardware problem known as keyboard blocking, hence it’s different for every user. there’s not much you can do on the software side other than using different key combinations. modern keyboards don’t have that problem anymore.


  27. Jet
    Visit Site
    May 13th, 2009

    WIN 10,0,22,87

    Work any combinations, even with 4 keys. But SPACE+UP+LEFT _sometimes_(???) doesn’t. Couldn’t figure out the reason and the way to reproduce, but it seems not to be only the hardware woodoo. IMHO if I can fire 4-keys combinations on my keyboard – it’s not an old one… not sure.

    Good luck in your quest )

Live Preview

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

CommentLuv Enabled

Images is enhanced with WordPress Lightbox JS by Zeo