471,854 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,854 software developers and data experts.

Dynamically loading swf with innerHTML

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 = 
  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>" +
  8.             "<embed src='mySwf.swf' quality=high wmode=transparent width='245' height='75' name='mySwf' type='application/x-shockwave-flash'>"+
  9.             "</embed>" +
  10.         "</object>";
  13.     document.getElementById("swfDiv").innerHTML = swfContent;
Mar 28 '07 #1
6 19342
1,208 Expert 1GB
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
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.

Mar 28 '07 #3
16,027 Expert Mod 8TB
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
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
Problem seems to be solved...

This solution did the trick... compatibility issues as always...
Mar 29 '07 #6
16,027 Expert Mod 8TB
Heh? Was that me?

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

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Randy Webb | last post: by
1 post views Thread by José Joye | last post: by
5 posts views Thread by footballhead | last post: by
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.