5 Replies Latest reply on Nov 4, 2011 5:06 AM by Juhb

    Key.getCode() problems on PC and published .exe, .swf and .app




      I have a kind of unusual problem... Im building a prototype for a UI wich you can navigate around in. And we use a mockup-prototype-model with a numeric keyboard built in and connected trough USB to fetch keypresses and use that as a joystick to navigate around and get a feeling how it would feel like to navigate around using a joystick in your hands.


      The problem is that it sends kind of unusual keypresses from the joystick.


      Everything works fine when I test the movie in Flash CS5 on a mac (cmd + enter). But not on a PC or in all of the published modes (.exe, .swf or .app).


      The codes I use in my if statements to navigate that doesnt work is:


      Key.getCode() == 188, Key.getCode() == 74 and Key.getCode() == 54


      Today I use a double setup of keys so that I can use my keyboard on the computer as a backup to navigate around. And those keypresses works fine without problems. It is just those three (188, 74 and 54) that doesnt work.


      example code:


      keyListener.onKeyUp = function() {

          trace("UP -> Code: "+Key.getCode()+"\tASCII: "+Key.getAscii()+"\tKey: "+chr(Key.getAscii()));


      if((freezeActive == true && Key.getCode() == 188) || (freezeActive == true && Key.getCode() == 72)){







      I have made sure that flash has focus when ive tried this. But it is so odd that it works when I test the movie but not when I run it on a PC or in any of the published applications...


      Have any of you encountered that some keypresses doesnt work?


      Best regards