Flex iFrame stealing focus!
Submitted by jrowny on Wed, 10/22/2008 - 07:00
If you're using Christopher Conraet's and Brian Deitte's Iframe component for Flex and you try to change the URL in it to a page with a form, you've probably run into the "stolen focus" issue. In IE, the focus is completely gone from Flex, and will not return! After a lot of frustration, I finally figured out a solution that's really easy. First add this Javascript to your index.template.html.
<script type="text/javascript">
function SetFocus(){
window.focus();
document.getElementById('${application}').focus();
}
</script>
The first line of code puts the focus back in the parent window (as opposed to the iFrame window) and the second one puts the focus directly on the Flex application. But wait! There's more! We have to call this function right? Simple! Just modify iFrame.as on line 143 in the static var FUNCTION_LOADIFRAME.
onLoad='SetFocus();'
And that's it! Now your iframe won't steal your focus when you change the URL!
Bookmark/Search this post with:
Would have been nice to
Submitted by Julien Nicoulaud (not verified) on Mon, 10/26/2009 - 10:28.Would have been nice to contribute it to the flex-iframe project developers !
:(
Submitted by jrowny on Thu, 11/19/2009 - 14:13.When I wrote this I was not aware of the google project page, but I did send an email to the original developers.