I've been having endless problems embedding a dynamically loaded SWF into a HTML Form within IE 6,7,8 using swfobject.embedSwf.
All the proposed manual workarounds for the problem involve creating a reference to the Object DOM element from the window object. For example:
window[id] = document.getElementById(id);
Where id is the id of the swf object dom element. In my case I cannot set window[id]
to the swf object id because it hasn't been created yet!
The line in swfobject that's causing the javascript errors is:
el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
As the SWF movie sets up its Javascript external interface it tries to access window[id]. Since this doesn't exist, it fails.
If I apply the workaround mentioned above and populate window[id]
with the DOM element that's being replaced by embedSwf it still fails beacuse it's trying to call Flash specific methods on a div DOM element rather than an object DOM element.
I find it amazing that this problem hasn't been fixed since Flash 8 and IE6!