Dynamically loading swf with innerHTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • carllucas
    New Member
    • Oct 2006
    • 35

    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

    Code:
    	var swfContent = 
    
    		"<object width='245' height='75' id='mySwf'>" +
    			"<param name=movie value='mySwf.swf'>" +
    			"<param name=quality value=high>" +
    			"<param name=wmode value=transparent>" +
    
    			"<embed src='mySwf.swf' quality=high wmode=transparent width='245' height='75' name='mySwf' type='application/x-shockwave-flash'>"+
    			"</embed>" +
    		"</object>";
    
    
    	document.getElementById("swfDiv").innerHTML = swfContent;
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    why don't you just change the source and not the entire html?

    or create the object and append it to the div

    Comment

    • carllucas
      New Member
      • Oct 2006
      • 35

      #3
      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

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        I don't work with Flash, but could you not just change the parameters as well as the src each time?

        Comment

        • carllucas
          New Member
          • Oct 2006
          • 35

          #5
          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.object 1.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.

          Comment

          • carllucas
            New Member
            • Oct 2006
            • 35

            #6
            Problem seems to be solved...

            This solution did the trick... compatibility issues as always...
            http://www.thescripts.com/forum/thread603298.html

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Heh? Was that me?

              Glad you got it working.

              Comment

              Working...