使用SWFObject加载SWF时调整其大小 [英] Resize an SWF when loading it with SWFObject

查看:134
本文介绍了使用SWFObject加载SWF时调整其大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SWFObject 将SWF电影加载到HTML页面中。我想动态调整这个SWF。 SWFObject如何提供帮助?我相信我不必编写我自己的解决方案。

解决方案最简单的解决方案是将SWF嵌入到容器div中,然后使用JavaScript和CSS动态调整容器DIV的大小。如果SWF设置为宽度/高度的100%,那么每当包装器被调整大小时,它将被拉伸以适合包装器。



在正文中:

 < div id =wrapper> 
< div id =flash>这个div会被SWFObject< / div>
< / div>



pre > <脚本>
var flashvars = {};
var params = {scale:exactFit};
var attributes = {};

swfobject.embedSWF(myContent.swf,flash,100%,100%,9.0.0,expressInstall.swf,flashvars,params,attributes) ;
< / script>

< style type =text / css>
#flash {
display:block;
宽度:100%;
身高:100%;
}
< / style>

现在,无论您调整#wrapper的大小,SWF都会调整以填充它。


I'm loading an SWF movie into an HTML page using SWFObject. I want to resize this SWF dynamically. How can SWFObject help? I'm sure I don't have to write my own solution.

解决方案

The easiest solution is to embed the SWF within a container div, then use JavaScript and CSS to dynamically resize the container DIV. If the SWF is set to 100% width/height, it will stretch to fit the wrapper whenever the wrapper is resized.

In the body:

<div id="wrapper">
<div id="flash">This div will be replaced by an object via SWFObject</div>
</div>

In the head:

<script>
var flashvars = {};
var params = { scale: "exactFit" };
var attributes = {};

swfobject.embedSWF("myContent.swf", "flash", "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes);
</script>

<style type="text/css">
#flash {
   display: block;
   width: 100%;
   height: 100%;
}
</style>

Now whenever you resize #wrapper, the SWF will scale to fill it.

这篇关于使用SWFObject加载SWF时调整其大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆