SWFObject 无法在 IE 中嵌入 Flash
尝试了 4 个小时才解决这个问题。 我有一个非常奇怪的问题:SWFObject 在除 IE 之外的所有浏览器中都很好地嵌入了 flash。 我将每个输出的div的HTML打印到文本区域中,发现在IE中,SWFObject仅嵌入根“object”标签,没有任何内部标签(例如param name =“movie”value =“myVal”),所以我想这就是为什么我在 IE 中收到“电影未加载”的信息。
我的代码如下:
window.embedFlash=function (properties)
{
swfobject.addDomLoadEvent(function ()
{
swfobject.createSWF(
{
data: properties.data,
width: properties.width||'100%',
height: properties.height||'100%'
},
{
allowScriptAccess: 'always',
allowFullScreen: 'true',
allowNetworking: properties.allowNetworking||'all',
flashvars: properties.flashvars||null,
wmode: properties.wmode||null,
menu: properties.menu||'false'
},properties.id);
});
};
Been trying 4 hours to solve this out.
I've a really strange problem: SWFObject embeds flash good in all browsers except IE.
I printed the HTML of each outputted div into a textarea, and found out that in IE, SWFObject embeds the root "object" tag only, without any inner tags (such a param name="movie" value="myVal"), so I guess this is why I get "movie not loaded" in IE.
My code as follows:
window.embedFlash=function (properties)
{
swfobject.addDomLoadEvent(function ()
{
swfobject.createSWF(
{
data: properties.data,
width: properties.width||'100%',
height: properties.height||'100%'
},
{
allowScriptAccess: 'always',
allowFullScreen: 'true',
allowNetworking: properties.allowNetworking||'all',
flashvars: properties.flashvars||null,
wmode: properties.wmode||null,
menu: properties.menu||'false'
},properties.id);
});
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常“电影未加载”意味着 Flash Player AVM 实例已启动,但无法找到您提供的 URL。
此外,您的 SWF 版本可能与 IE 中的 Flash Player 版本不同步。
检查是否出现 404 错误,并检查编译后的 SWF 版本是否可以在安装到 IE 的 FP 版本中运行。
Usually "movie not loaded" means Flash Player AVM instance has started, but the URL you provided can't be found.
Also, your SWF version may be out of sync with the Flash Player version in IE.
Check if you get any 404s and check if the compiled SWF version is runnable in the FP version installed to IE.
您基本上是在重新创建
swfobject.embedSWF
方法,因此我建议重新格式化您的代码以使用swfobject.embedSWF
,因为它受到广泛支持并经过严格测试。我发现您的代码和embedSWF
之间的唯一区别是:代码(embedSWF 要求您
指定 Flash 的最低版本
您的播放器
代码(这可以设置为 false
embedSWF 如果您不感兴趣,
格式化为字符串,而 embedSWF
需要一个包含键/值对的对象
swfobject.embedSWF
默认情况下会在 domload 上调用,因此您不需要编写 ondomload 处理程序以下是代码的快速重新格式化。如果你的 flashvars 作为字符串发送,它将失败:
You're basically recreating the
swfobject.embedSWF
method, so I suggest reformatting your code to useswfobject.embedSWF
, as it is widely supported and heavily tested. The only differences I see between your code andembedSWF
are:code (embedSWF requires you to
specify a minimum version of Flash
Player
code (this can be set to false in
embedSWF if you're not interested
formatted as a string, whereas embedSWF
expects an object containing key/value pairs
swfobject.embedSWF
gets invoked on domload by default, so you wouldn't need to write an ondomload handlerHere's a quickie reformat of your code. It will fail if your flashvars are sent as a string: