PDA

View Full Version : IE7: onKeyDown event not firing when Flash object has focus


BigJake
01-31-2008, 04:34 AM
I have a Flash application (developed during the reign of IE6) which, because of the need for special capabilities, handles all keyboard and mouse input via Javascript.

Enter IE7. For some reason, when you click on a Flash object in IE7 (like to navigate to another input field), the Flash object seems to receive and then RETAIN focus, so that the Javascript no longer receives keyboard input. However, if you click on the browser background (outside of the border of the Flash object), the Javascript starts receiving keyboard input again. This same application in IE6 doesn't act this way. Does anyone have an idea what the deal is (and of course, how to fix it)?

Thank you.

Paul Ferrie
01-31-2008, 07:25 AM
Can you post a link?

BigJake
01-31-2008, 05:26 PM
Yes. Here's a link:

http://www.patbless.com/onKeyDownTest.html

I have pared down the Javascript, leaving only the pertinent part. It just has an alert showing the numeric code of the key pressed. The Flash object is just a blank square.

Thank you for taking a look, Paul.

Paul Ferrie
01-31-2008, 05:43 PM
I think your going to be hard pushed to find people still with flash player 6 in browser.
Also i could be wrong but is the js not supposed to be between the <head></head> tags.
This might be just a typo of you quickly putting a page together.

Dont know of a work around. Maybe if you can give an idea of what your working on then there migh be a better solution. Flash has come a long way sine early IE6

BigJake
01-31-2008, 06:22 PM
Yes, my application was written with Flash MX (6), but people are running it in Flash Player 9. The 6 is only there to ensure that people at least have that version. I'm using Flash 8 for all my current stuff, but I haven't had time to port this particular app - working on to many other things.

The problem isn't Flash 6. Heck, here's the identical thing with a Flash 8 object:

http://www.patbless.com/onKeyDownTest2.html

The problem seems to be the way JavaScript behaves (when a Flash object is involved) in IE7 versus IE6.