Forum Moderators: open

Message Too Old, No Replies

Dynamic flash movies

IE not obeying my commands...

         

chrisjoha

10:41 pm on Sep 25, 2005 (gmt 0)

10+ Year Member



I'm trying to dynamically insert a flash movie on my page when this and that event occurs. To make things alittle harder, I'm doing this with object alone (no embed) to make it XHTML compatible. I need to generate this code:

<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.)

Bernard Marx

10:43 am on Sep 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does IE accept Flash objects marked-up with <object>?

chrisjoha

10:53 am on Sep 26, 2005 (gmt 0)

10+ Year Member



As I wrote in my first post,


<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.

chrisjoha

7:33 am on Sep 27, 2005 (gmt 0)

10+ Year Member



Does anyone have any help to offer?