This content has been marked as final. Show 4 replies
"Richard_Abbott" <firstname.lastname@example.org> wrote in message
> Hi all,
> put my SWF file into the right part of the DOM on a page. On one page it
> be nice if the user was able to type straight away into a text input.
> setFocus() on this control in creation_complete does the trick so far as
> is concerned, but the Flex app itself is not getting focus. So the page
> as though the text input has focus, but in fact you have to click on the
> Flex-controlled area in order to actually begin to type.
> Any ideas how I would set focus in a complete sense so the user can just
> without clicking?
looks like you are right about this, and moreover we are back in browser-dependent land. The following articles deal with it a bit...
but it seems there is no generally-valid way to do it. Thanks anyway for the tip,
Thanks for your contribution.
I was facing the same problem. Now its running fine.
Just to tidy this up, I found some code that works for IE and Firefox (at least on Windows, haven't yet tested elsewhere). The problems are:
1) IE and FF refer to the Flex application in different ways (as documented in the Flex doc under ExternalInterface)
2) The sequence of start-up operations is different, so FF does not have the Flex app ready to be queried until later.
#2 means that if you just stick some code in directly after the AC_FL_RunContent(...) call then IE works but FF does not. In the end I did something more long-winded which at least has the advantage of working. Into the HTML (a convenient place is in the script block that has
// Major version of Flash required
etc) I put the following
window.onload = function()
if (navigator.appName.indexOf("Microsoft") != -1)
} // if Microsoft
// other browser
} // else
if (document["Logon"] == null)
} // if (document["Logon"] == null)
} // try
} // catch
} // else
} // do_other_focus
where flexEnsureFocus is the external name of a Flex function that calls userNameTextInput.setFocus();
A bit hacky, perhaps, and it still does not extend to working on Safari or Opera, but it's a step in the right direction...