Flex Focus issue

I came across an interesting bug which is reproducible only in IE6 and IE7.  I have a web page which has a SWF file embeded.  There is a IFRAME  in that web page and that IFRAME contains a HTML input field. There is also a Flex Text Field in the SWF file.  Now the issue is the flex text field is not gaining focus after clicking on the HTML input field. There is a bug which was filed with adobe but closed without any resolution.

The SWF file and the HTML file are in two layers in the browser and focus is not getting passed to the SWF file from HTML in a IFRAME. So as a work around i needed to set the focus using javascript.

//Flex code
 private function gainCursor() : void
 {
      var textID:* = focusManager.getFocus() as TextInput;
      if (textID is TextInput)
         {
            ExternalInterface.call("deFocus");
            focusManager.setFocus(IFocusManagerComponent(textID));
         }
 }

// javascript function
function deFocus()
 {
      window.focus();
      window.document["YourSWFFilenamehere"].focus();
 }