使用SWFObject加载SWF时调整其大小 [英] Resize an SWF when loading it with SWFObject
问题描述
我使用 SWFObject 将SWF电影加载到HTML页面中。我想动态调整这个SWF。 SWFObject如何提供帮助?我相信我不必编写我自己的解决方案。
在正文中:
< 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屋!