364,083 Members | 5574 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Dynamically loading swf with innerHTML

carllucas
P: 35
I'm not really a IE (Internet Explorer) basher but sometimes it does get really trying!

I'm trying to dynamically load a swf (Flash) file into a div using innerHTML. 2 versions of IE won't do it properly:

MSIE 6.0 on Windows
MSIE 5.5 on Windows

Both don't load anything...

Does anyone know what on earth could be the problem? It works flawlessly with almost every other browser (including later versions of EI) and on all platforms (Linux, Mac and Windows)!

Please help. I'm inclined to join the anti-IE bandwagon really soon cos this has been driving me nuts!

Here is my code below. Note: other innerHTML calls work fine with both MSIE6.0 and 5.5

Expand|Select|Wrap|Line Numbers
  1.     var swfContent = 
  2.  
  3.         "<object width='245' height='75' id='mySwf'>" +
  4.             "<param name=movie value='mySwf.swf'>" +
  5.             "<param name=quality value=high>" +
  6.             "<param name=wmode value=transparent>" +
  7.  
  8.             "<embed src='mySwf.swf' quality=high wmode=transparent width='245' height='75' name='mySwf' type='application/x-shockwave-flash'>"+
  9.             "</embed>" +
  10.         "</object>";
  11.  
  12.  
  13.     document.getElementById("swfDiv").innerHTML = swfContent;
  14.  
Mar 28 '07 #1
Share this Question
Share on Google+
6 Replies


iam_clint
Expert 100+
P: 1,070
why don't you just change the source and not the entire html?

or create the object and append it to the div
Mar 28 '07 #2

carllucas
P: 35
I need the flash object to be reloaded with a fresh flash movie each time a user calls a function and I need some of the flash variables in the object declaration to change. This is why I need the object to be dynamically loaded and placed into a div each time.

This system work perfectly excpet with MSIE5.5 and MSIE 6.0 which won't load any flash movie.

Perhaps someone can put my code in a function and test it on their system for me and see if they can figure out why this is so.

Thanks
Mar 28 '07 #3

acoder
Expert Mod 10K+
P: 13,930
I don't work with Flash, but could you not just change the parameters as well as the src each time?
Mar 29 '07 #4

carllucas
P: 35
Okay then... I'm willing to give that a try. How do you change the <OBJECT> parameters dynamically? Is it like with <FORM> (i.e.: document.object1.param1.value = newValue) ?

Will this then automatically load a new movie?

I'm going to go give this a try. If I'm heading in the wrong direction please tell me. But (and not to sound stuborn here...) i still don't understand why the original method wouldn't work in MSIE5.5 and MSIE6.0 since innerHTML works and Flash objects work? It would still be good to know for future why this is a problem in the first place.
Mar 29 '07 #5

carllucas
P: 35
Problem seems to be solved...

This solution did the trick... compatibility issues as always...
http://www.thescripts.com/forum/thread603298.html
Mar 29 '07 #6

acoder
Expert Mod 10K+
P: 13,930
Heh? Was that me?

Glad you got it working.
Mar 30 '07 #7

Post your reply

Help answer this question



Didn't find the answer to your JavaScript / Ajax / DHTML question?

You can also browse similar questions: JavaScript / Ajax / DHTML innerhtml swf