Forum Moderators: open
<object type="application/x-shockwave-flash" data="somefile.swf" width="100" height="100">
<param name="movie" value="somefile.swf" />
<param name="FlashVars" value="&dataUrl=somefile.xml" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
</object>
which works fine in IE, Opera and Firefox. Great. Then I did this to make it dynamic:
function graphBox(dataUrl, chartFile) {
if (!document.createElement ¦¦!document.getElementById)
return;
var box = document.createElement('div');
box.appendChild(createCloseButton());
var obj = createFlashObject(chartFile, '565', '420');
box.className = 'graphBox';
box.appendChild(obj);
obj.appendChild(createParam('movie', chartFile));
obj.appendChild(createParam('FlashVars', '&dataUrl=' + dataUrl));
obj.appendChild(createParam('quality', 'high'));
obj.appendChild(createParam('bgcolor', '#ffffff'));
return box;
}
/**
* Create a flash object
*/
function createFlashObject(data, width, height) {
var obj = document.createElement('object');
obj.setAttribute('type', 'application/x-shockwave-flash');
obj.setAttribute('data', data);
obj.setAttribute('width', width);
obj.setAttribute('height', height);
return obj;
}
/**
* Create a param element with name and value attributes
*/
function createParam(nameStr, valueStr) {
var el = document.createElement('param');
el.setAttribute('name', nameStr);
el.setAttribute('value', valueStr);
return el;
}
Which works in Firefox and Opera. Damn, lost IE. Does anyone have any idea why IE won't play along? (IE displays the div with nothing inside.)
<object type="application/x-shockwave-flash" data="somefile.swf" width="100" height="100">
<param name="movie" value="somefile.swf" />
<param name="FlashVars" value="&dataUrl=somefile.xml" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
</object>
works fine in IE, yes. If you're interested in more on this, check out a list aparts article on standards compliant flash movies.