簡體   English   中英

如何將swf文件放在不同的屏幕尺寸上?

[英]How to centre a swf file on different screen resoutions?

有誰知道如何居中放置在兩邊都切掉的swf文件的中心,而不是只知道在不同屏幕分辨率下居中對齊的權利嗎?

我希望它類似於此站點的橫幅http://www.mondoliving.com.au/如果更改屏幕分辨率或瀏覽器窗口大小,則圖像將停留在中心位置,但不會縮放,僅顯示的寬度似乎會改變通過在每一側裁剪。

我嘗試使用適用於不同屏幕分辨率的javascript,但首先將swf加載到左側,然后將其居中,這似乎跳到了中心。 我想知道是否有人有新的,更流暢的方法? 我想知道是否可以在swf中使用Action腳本來完成?

我使用的JavaScript是:

<script type="text/javascript">
function centerSWF()
{
 var sw;
 if(parseInt(navigator.appVersion)>3)
 {
  if(navigator.appName=="Netscape"){sw = window.innerWidth-17;}
  if(navigator.appName.indexOf("Microsoft")!=-1){sw = document.body.offsetWidth-0;}
  }
 var w = (sw-1500)/2;
 document.getElementById("flashbg").style.width = sw+"px";
 document.getElementById("flash").style.marginLeft = w+"px";
}
</script>

</head>

<body onload="centerSWF()">

然后我嵌入了瑞士法郎。

嵌入式代碼:

<div id="flash_box">
<div id="flashbg" class="flashbg">
 <div id="flash" class="flash">
      <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1500" height="250">
        <param name="movie" value="img/top14.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="scale" value="noborder" />
        <param name="swfversion" value="9.0.45.0" />
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
        <param name="expressinstall" value="Scripts/expressInstall.swf" />
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="img/top14.swf" width="1500" height="250">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="wmode" value="opaque" />
         <param name="swfversion" value="9.0.45.0" />
         <param name="expressinstall" value="Scripts/expressInstall.swf" />
         <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
           <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>
  </div>
</div>
</div>
<!--End flash_box -->

和CSS:

#flash_box {
margin:auto;
padding:0px 0px 5px 0px;
border-bottom:double #e9e8e8 thin;
border-collapse:collapse;
height:250px;
overflow:hidden;
}

.flashbg{position:absolute;overflow:hidden;}
.flash{width:1500px;}

謝謝任何幫助,不勝感激。

在CSS中進行這些更改-

#flash_box {
margin: 0 auto;
padding:0px 0px 5px 0px;
border-bottom:double #e9e8e8 thin;
border-collapse:collapse;
height:250px;
overflow:hidden;
text-align: center;
}
.flashbg{/*position:absolute;overflow:hidden;*/}
.flash{width:1500px; text-align: center;}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM