I have an interactive flash app on my website - the app and the website are both under my control, so I can edit both of them (that is, this isn't a user-submitted content site, where I could maybe only control the game content, or just the website).
This is the flash app's embed code:
<object name="flashApp" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="FlashApp" width="600" height="600" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="apps开发者_开发问答/1234.swf" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="apps/1234.swf" width="600" height="600" quality="high" name="exampleApp" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
Around the flash app are several links that allow the user to click things which perform javascript actions that modify the flash content. The javascript communicates with the flash app, and the app communicates with the javascript.
One small problem I'm having though, is that when the user clicks one of the javascript buttons or links, focus is lost from the flash app. For example, they might click "Learn about X" (one of the javascript links), and the flash app will proceed, but when the user tries to use the arrow keys after that, nothing happens in the flash app. Instead the user must click back inside the flash app first before using the keyboard again.
What I'd like is a javascript function that can be called in order to restore keyboard and mouse focus to the flash app and which will work in IE, Firefox, and Chrome.
Any ideas?
精彩评论