swfobject 在 swf 加载之前闪烁白色
我有以下代码,我已经设置了背景颜色,但我的页面在 swf 加载之前仍然闪烁白色。基本上我希望背景始终为黑色,我的页面正文标记有黑色背景。
<script type="text/javascript">
var path = "/media/19519/la_03.swf";
var videowidth = "955";
var videoid = "swf1454";
var videoheight = "540";
var flashvars = {};
var attributes = {};
var params = {
wmode: "opaque",
bgcolor: "#000000",
allowfullscreen: "true",
allscriptaccess: "always"
};
swfobject.embedSWF(path, videoid, videowidth, videoheight, "9.0.0", flashvars, params, attributes);
</script>
I have the following code, I have set the bgcolor and still my page flashes white prior to swf loading. Basically i want the background to always be black, my page body tag has a black background.
<script type="text/javascript">
var path = "/media/19519/la_03.swf";
var videowidth = "955";
var videoid = "swf1454";
var videoheight = "540";
var flashvars = {};
var attributes = {};
var params = {
wmode: "opaque",
bgcolor: "#000000",
allowfullscreen: "true",
allscriptaccess: "always"
};
swfobject.embedSWF(path, videoid, videowidth, videoheight, "9.0.0", flashvars, params, attributes);
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它可能来自您的 swf 加载。我在处理大型 swf 时遇到了类似的问题,我让它停止的方法是在第一帧中暂停 swf,直到加载完成。然后只需在 1 处放置一个空帧并将其设为背景颜色即可。一旦 swf 准备就绪,动画就会开始
it's probably from your swf loading. I had a similar problem with a large swf and the way I got it to stop was to pause the swf in the first frame until it was done loading. Then just put an empty frame at 1 and make it the bg color. Once the swf is ready to go the animation starts
确保包含 swf 的 html 元素也是黑色的。
Make sure the html element containing the swf is black too.
我知道这是一篇旧文章,但对于通过搜索引擎偶然发现这篇文章的人来说:
白色闪光有时是 SWFObject 的“自动隐藏”功能的副产品(CSS 用于在 SWF 加载之前隐藏后备内容)。如果您不想看到白色闪光,请尝试禁用 SWFObject 的自动隐藏功能:
SWFObject 文档:
当然,您构建 SWF 的方式也会影响您是否看到白色闪光。
I know this is an old post, but for people who stumble upon this post via search engines:
A flash of white is sometimes a byproduct of SWFObject's 'autohide' feature (CSS is used to hide the fallback content before the SWF loads). If you don't want to see the flash of white, try disabling SWFObject's autohide feature:
SWFObject documentation:
Of course, how you build your SWF will also impact whether you see a flash of white.
对我来说,问题在于 swf 文件的背景颜色。
如果未明确设置,则在加载之前默认为白色。所以只要明确设置它,就不会出现白色闪光。
For me, the issue was in background color of the swf file.
When not explicitly set, it defaults to white until loaded. So just set it explicitly and you won't have a white flash.