有谁知道如何将一个 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;}
谢谢任何帮助非常感谢。