swfObject 导致“对象不支持” __flash__addCallback 函数中的错误
所以,我已经被这个问题困扰有一段时间了,这给我带来了很多挫败感。我在我搜索过的许多论坛页面上发现很多人都有同样的问题,但没有人给出明确的答案,说明为什么会抛出此错误以及如何修复它。
我正在使用 swfObject 2.2 将背景视频嵌入到我正在处理的页面上,并且 IE7/IE8 抛出错误:由于第 48 行字符 3,“对象不支持此属性或方法”。打开开发人员工具后要查看导致此错误的代码,我发现了这一点:
function __flash__addCallback (instance, name) {
instance[name] = function () {
return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
}
}
我尝试查找代码中出错的地方,并注释掉除此之外的所有内容:
swfobject.embedSWF('http://localhost/flash/player.swf', 'video_player', '100%', '100%', '9.0.0');
这是 swfobject 正在查找的元素:
<div id="video_player"></div>
为了更进一步,我使用了完全空的 .swf 文件,以确保 .swf 文件本身不会引发错误。
我真的很想知道是否有人有使用 swfobject 遇到此错误的经验,以及我是否可以采取一些措施来解决它。
So, I have been stuck on this problem for some time now and it has caused a lot of frustration. I have found a lot of people over the many forum pages I have scoured who share the same problem but no one who has gave a clear answer as to why is this error being thrown and how to fix it.
I am using swfObject 2.2 to embed a background video onto a page I am working on and IE7/IE8 is throwing the error: "Object doesn't support this property or method" due to line 48 character 3. Upon opening up the developer tools to see what code is causing this error, I found this:
function __flash__addCallback (instance, name) {
instance[name] = function () {
return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
}
}
I tried finding where I was going wrong in my code and commented out everything besides:
swfobject.embedSWF('http://localhost/flash/player.swf', 'video_player', '100%', '100%', '9.0.0');
This is the element swfobject is looking for:
<div id="video_player"></div>
To go a step further, I used an entirely empty .swf file to make sure the error was not being thrown by the .swf file itself.
I would really like to know if anyone has had experience with this error using swfobject and if there is something I can do to solve it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题,我发现了这个博客条目:
Adobe FlashExternalInterface 与 Internet Explorer 的问题
总结一下,这可能与 play() 和 stop() 函数是保留字有关。尽管您提到您没有使用ExternalInterface 调用,但您是否尝试过重命名这些方法?
I was having the same problem, and I found this blog entry:
Adobe Flash ExternalInterface issues with Internet Explorer
To summarize this maybe related to the play() and stop() function being reserved words. Even though you mentioned you are not using ExternalInterface calls, but have you tried renaming these methods yet?
我想根据 IE8 添加到“坏”单词列表中。
我们必须重命名称为“缩放”和“平移”的方法,这会导致相同的问题。其他人报告说“停止”是另一个不好的词。
幸运的是,修复比找到确切的原因更容易:只需重命名您的方法即可。
I'd like to add to the list of 'bad' words according to IE8.
We had to rename methods called 'zoom' and 'pan' which were causing the same issue. Other people have reported 'stop' as another bad word to use.
Luckily the fix is easier than finding the precise cause: just rename your methods.