Usually flash movies needs to be clicked to make them gain focus before they can be interacted via keyboard. If you want to gain automagically when your movie starts, you can do it via javascript. It's just a matter of calling the focus() method on the right html element at the right time.
You can find here an example made using SWFObject. The setFocusOnFlash() is used as a callback by the embedSWF() method. An event object is sent along the function callback, holding the operation status, the html element id and a direct reference to the html element.
Notes:
You can find here an example made using SWFObject. The setFocusOnFlash() is used as a callback by the embedSWF() method. An event object is sent along the function callback, holding the operation status, the html element id and a direct reference to the html element.
Notes:
- make sure to use wmode opaque or transparent, otherwise this trick won't work on chrome and safari
- make sure to set the tabIndex property on the html element you're going to focus, otherwise it won't be in the "tabbing list" and some browsers (chrome and safari) will ignore the focus() call
- on firefox (both 3.6 and 4.0) the callback is fired a bit too early, hence the need for a small timer before the actual call
<script type="text/javascript">
function setFocusOnFlash(e) {
setTimeout(function() {
if (e.success) {
e.ref.tabIndex = 0;
e.ref.focus();
}
},125);
}
var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#000000";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
params.wmode = "opaque";
var attributes = {};
attributes.id = "MyMovie";
attributes.name = "MyMovie";
attributes.align = "middle";
swfobject.embedSWF(
"MyMovie.swf", "flashContent",
"300", "200",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes, setFocusOnFlash);
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>


