5 Replies Latest reply on Dec 13, 2009 6:47 PM by carl schooff

    Setting SWF Movie size using CSS or JavaScript - help!

    bwanakahawa

      Hi,
      I'm completely stuck on this. I need to set the scale a Flash movie plays at using CSS or JavaScript. It doesn't seem to work - I seem to have to dictate the dimensions within the OBJECT and EMBED tags instead.

      Here's the code I've been trying:

      Code:
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="960" height="463" id="intro_ob" align="middle">
           <param name="allowScriptAccess" value="sameDomain" />
           <param name="movie" value="intro.swf" />
           <param name="quality" value="best" />
           <param name="scale" value="noborder" />
           <param name="bgcolor" value="#ffffff" />
           <embed src="intro.swf" quality="best" scale="noborder" bgcolor="#ffffff" width="960" height="463" name="intro_em" id="intro_em" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
           </object>
           
           <script type="text/javascript">
           if (window.innerWidth > 1120) {
                
                document.getElementById("intro_ob").style.width = 1098;
                document.getElementById("intro_ob").style.height = 530;
                document.getElementById("intro_em").style.width = 1098;
                document.getElementById("intro_em").style.height = 530;
           }
           </script>

      I've tried both document.getElementById("intro_ob").style.width and document.getElementById("intro_ob").width but tneither seem to work.

       

      I can't dictate the width and height tags in the OBJECT using PHP or anything, as it's the first page thr user comes to (and hence can't send the info regarding resolution to the server until they move into the rest of the site) (I've already looked into using Ajax and XML to send the resolution to the server on arrival - can't get it to work on IE)

       

      So what I need is a way of scaling the Flash movie using either JavaScript or CSS. The site is due to go live Monday and I'm still stumped - please help!