title: Center swf object on html page
body: <p>I have an SWF object that I have embedded on an html page. I simply want to center the object on the screen. I've tried a hundred different things (setting the align attributes on the object to center, wrapping the object in a div and centering that...) but the object always appears flush with the left side of the screen. I'm sure its a very simple line of code somewhere that will make this work, please enlighten me as to what that is...</p>
  
  <pre><code>This application was built using Adobe Flex, an open source framework
  for building rich Internet applications that get delivered via the
  Flash Player or to desktops via Adobe AIR. 
  
  Learn more about Flex at http://flex.org 
  // --&gt;&lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;meta name="google" value="notranslate" /&gt;         
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  
      &lt;style type="text/css" media="screen"&gt; 
          html, body  { height:100%; }
          body { margin:0; padding:0; overflow:auto; text-align:center; background-     position:center;
                 background-color: #000000;}   
          object:focus { outline:none; }
               #flashContent { display:; }
  
   &lt;/style&gt;
  
      &lt;!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens --&gt;
      &lt;!-- BEGIN Browser History required section --&gt;
      &lt;link rel="stylesheet" type="text/css" href="history/history.css" /&gt;
      &lt;script type="text/javascript" src="history/history.js"&gt;&lt;/script&gt;
      &lt;!-- END Browser History required section --&gt;  
  
      &lt;script type="text/javascript" src="swfobject.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
          var swfVersionStr = "10.2.0";
          // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
          var xiSwfUrlStr = "playerProductInstall.swf";
          var flashvars = {};
          var params = {};
          params.quality = "high";
          params.bgcolor = "#000000";
          params.allowscriptaccess = "sameDomain";
          params.allowfullscreen = "true";
          var attributes = {};
          attributes.id = "Main";
          attributes.name = "Main";
          attributes.align = "middle";
          swfobject.embedSWF(
              "Main.swf", "flashContent", 
              "100%", "100%", 
              swfVersionStr, xiSwfUrlStr, 
              flashvars, params, attributes);
          // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
          swfobject.createCSS("#flashContent", "display:block;text-align:center;");
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;div id="flashContent" align="center"&gt;
          &lt;p&gt;
              To view this page ensure that Adobe Flash Player version 
              10.2.0 or greater is installed. 
          &lt;/p&gt;
          &lt;script type="text/javascript"&gt; 
              var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://"); 
              document.write("&lt;a href='http://www.adobe.com/go/getflashplayer'&gt;&lt;img src='" 
                              + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /&gt;&lt;/a&gt;" ); 
          &lt;/script&gt; 
      &lt;/div&gt;
  
      &lt;noscript&gt;
      &lt;div align="center"&gt;
        &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" align="middle" id="Main"&gt;
          &lt;param name="movie" value="Main.swf" /&gt;
          &lt;param name="quality" value="high" /&gt;
          &lt;param name="bgcolor" value="#000000" /&gt;
          &lt;param name="allowScriptAccess" value="sameDomain" /&gt;
          &lt;param name="allowFullScreen" value="true" /&gt;
          &lt;param name="wmode" value="opaque" /&gt;
          &lt;!--[if !IE]&gt;--&gt;
          &lt;object data="Main.swf" type="application/x-shockwave-flash" width="100%" height="100%" align="middle"&gt;
            &lt;param name="quality" value="high" /&gt;
            &lt;param name="bgcolor" value="#000000" /&gt;
            &lt;param name="allowScriptAccess" value="sameDomain" /&gt;
            &lt;param name="allowFullScreen" value="true" /&gt;
            &lt;param name="wmode" value="opaque" /&gt;
            &lt;!--&lt;![endif]--&gt;
            &lt;!--[if gte IE 6]&gt;--&gt;
            &lt;p&gt; 
              Either scripts and active content are not permitted to run or Adobe Flash Player version
              10.2.0 or greater is not installed.
              &lt;/p&gt;
            &lt;!--&lt;![endif]--&gt;
            &lt;a href="http://www.adobe.com/go/getflashplayer"&gt;
              &lt;img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" /&gt;
            &lt;/a&gt;
            &lt;!--[if !IE]&gt;--&gt;
            &lt;/object&gt;
          &lt;!--&lt;![endif]--&gt;
          &lt;/object&gt;
      &lt;/div&gt;
      &lt;/noscript&gt;     
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>PS this is my issue when I try to edit the html file generated with the SWF. When I try to create a new HTML file and embed the swf in it, I can center the file, but I can't get it the object to scale to fit the vertical dimensions of the screen (the objects at the bottom of the page are below view, whereas on the automatically-generated html file, the swf auto-zooms to fit the screen, but I can't center it..) A solution to either of these problems would be greatly appreciated</p>