You can only call upon DOM elements when the DOM is loaded. Just use
the SWFObject 2.0 API [
http://code.google.com/p/swfobject/wiki/SWFObject_2_0_api_javascript_dev
] to execute the functionality after the DOM is loaded and after your
Flash content has been inserted, e.g. add the following code after
your embedSwf method:
function setFocusOnFlash() {
var fl = document.getElementById(flashObjectId);
if (fl) { fl.focus(); }
}
if (swfobject.hasFlashPlayerVersion("9.0.0")) { // insert the version
you test for
swfobject.addDomLoadEvent(setFocusOnFlash);
}
Just let me know if this works for you.