如何将 swf 文件居中显示在不同的屏幕分辨率上

How to centre a swf file on different screen resoutions?

本文关键字:屏幕 分辨率 显示 swf 文件      更新时间:2023-09-26

有没有人知道如何将裁剪每一侧的 swf 文件居中,而不仅仅是使其在不同的屏幕分辨率下居中?

我希望它类似于本网站的横幅 http://www.mondoliving.com.au/如果您更改屏幕分辨率或浏览器窗口大小,图像将停留在中心但不缩放,仅显示的宽度似乎通过裁剪在每一侧而改变。

我尝试使用适用于不同屏幕分辨率的 javascript,但首先在左侧加载 swf,然后将其居中,这似乎跳到了中心。 我想知道是否有人采用不同的、更流畅的方法? 我想知道是否可以在 swf 中使用操作脚本完成?

我使用的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()">

然后我嵌入了 swf。

嵌入式代码:

<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;}