Skip to main content
Participant
January 11, 2011
Question

passing keystrokes from air browser to flash game

  • January 11, 2011
  • 1 reply
  • 429 views

Here's my situation - I am accessing some games that my company built  using a AIR browser (allowing us to sell an installable product on a CD,  but keeping the content online for ease of maintenance).  I can get the  games to load, but i cant get them to accept keystrokes, ie: we have a  tetris-like game that isnt getting any of the arrow key inputs.  I'm  fairly certain this has something to do with a focus issue, but I have  no idea how to fix it.  Any suggestions would be welcome.

This topic has been closed for replies.

1 reply

funkysoul
Inspiring
January 11, 2011

probably your key listeners are attached to the stage of the hosted SWF, but by loading that swf, it will take the current stage which in your case is the AIR application, have a look at that, it might be the case.

Participant
January 11, 2011

Thanks for the input.  I considered this, and did some testing.  I failed to mention in my original post that the browser loads a "virtual town" built in javascript, and the flash games are loaded from within this "town".  when i point the browser to the game directly, it works fine, but when i try to load it within the "town" contruct, then i don't get the keyboard input.  ive fooled around with javascript's focus(), but that doesnt seem to be helping anything.  i realize that a flash based browser loading a java based environment that launches flash games is FAR from ideal, but its what i have to work with (business decisions outside of my control) and rewriting the town in flash isn't an option (even though i would love too).  thanks again for your input, any other thoughts will be greatly appreciated.