I'm working on [#LPP-8283 "Alt tab issue when switching tasks in IE7/
Win"](http://bit.ly/WsowU).
In DHTML, we can listen for `window.focus` (or, in IE, the non-
standard `document.onfocusin`) to determine when the application
regains focus. We use that to call lz.Keys.__allKeysUp.[*]
In SWF, on every platform _but_ IE7/Win, this same solution also
works. We can establish the listener in the HTML wrapper and use the
lz.embed.callMethod interface.
Unfortunately, on IE7/Win with SWF, _if_ the SWF application has focus
within the page, no focus event is sent to the wrapper HTML!
In SWF9/IE7/Win we can work around this issue because SWF9 defines
Event.ACTIVATE on the Stage that we can listen for in the application.
That leaves SWF8/IE7/Win. I'm out of ideas. I don't see any event in
SWF8 that corresponds to the Stage ACTIVATE event in swf9. The
ActiveX control seems to swallow the focus events when it has focus
and does not propagate them to the HTML wrapper, but the event does
not surface anywhere that I can see in the SWF player. (I tried
listening for onfocusin on the actual <OBJECT> element. No joy. The
DOM elements in the wrapper _only_ receive the focus event if the
ActiveX/SWF player does _not_ have focus.)
If anyone has any ideas, I'd love to hear them.
---
[*] On the assumption that when we gain focus, we don't know what the
state of the keyboard is, we can't tell if keys that were down when we
lost focus are still down or have been released; so we take the safest
fallback and assume any keys that were down have been released. This
solves the dreaded 'stuck key' problem -- the user doesn't have to
guess which key to hit to release a stuck key. The trade-off is that
a key that is actually still down will not be seen, but the worst case
there is that the user will have to reassert the key. This is a
general problem in any application, even an OS-native application, if
there is not an API to poll the keyboard and ask it's state when an
application gets focus.