SetVariable 在 FireFox 中有效,但在 Internet Explorer 中无效?
我正在构建一个视频播放器网络应用程序,它使用 flash 进行播放,使用 jquery/javascript 作为 UI。根据编写 flash 组件的人的设计,我需要使用 setVariable 在 javascript 和 flash 播放器之间进行通信。我在互联网上读到很多人在使用 setVariable 在 FireFox 中工作时遇到问题。我在 Firefox 中设计了我的应用程序,因为我想使用 Firebug 来帮助我进行开发。现在整个事情已经构建完成,我发现 setVariable 在 IE 中不起作用。我得到的错误是: 对象不支持属性或方法“SetVariable”;
这里有一些相关的代码:
我通过 javascript 构造我的 html,所以这就是我构造播放器的方式:
var player =
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,16,0" width="1" height="1" >' +
'<param name="movie" value="/flash/Player.swf?server='+server+'">' +
'<param name="quality" value="high">' +
'<param name="play" value="true">' +
'<param name="LOOP" value="false">' +
'<param name="wmode" value="transparent">' +
'<embed wmode="transparent" src="/flash/Player.swf?server='+server+'" width="1" height="1" play="true" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' +
'</object>';
将其附加到页面后,我调用设置变量:
that.player.SetVariable('track',trackNo);
任何建议将不胜感激。我知道外部接口是跨js flash 公报的首选方法,但我无权访问 flash 文件,也无法更改它,所以请仅给出使用 setVariable 的解决方案。谢谢。
I am building a video player web-app that uses flash for playback and jquery/javascript for UI. By design of the person who wrote the flash component I need to use setVariable to communicate between the javascript and the flash player. I've read all over the internet that a lot of people have had problems gettin setVariable to work in FireFox. I designed my app in firefox because i wanted to use firebug to help me in development. Now that the whole thing has been built, i find that setVariable is not working in IE. The error i get is:
Object doesn't support property or method 'SetVariable';
Here's a bit of the pertinent code:
I construct my html through javascript, so this is how I construct the player:
var player =
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,16,0" width="1" height="1" >' +
'<param name="movie" value="/flash/Player.swf?server='+server+'">' +
'<param name="quality" value="high">' +
'<param name="play" value="true">' +
'<param name="LOOP" value="false">' +
'<param name="wmode" value="transparent">' +
'<embed wmode="transparent" src="/flash/Player.swf?server='+server+'" width="1" height="1" play="true" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' +
'</object>';
after I append this to the page I call set variable:
that.player.SetVariable('track',trackNo);
Any advice would be appreciated. I know external interface is the preferred method of cross js flash communique, but I don't have access to the flash file, and can't change it, so please only give solutions using setVariable. Thank You.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要知道的是,对于某些浏览器,您必须编写的嵌入 swf 文件的 html 代码是不同的。
Firefox 和其他基于 Netscape 的浏览器使用
您可以使用 SWFObject 将 swf 嵌入到您的网页上。
它是一个单文件开源库,可以为您处理所有跨浏览器 Flash 嵌入问题。
它甚至还附带一个方便的生成器来帮助您制作正确的嵌入代码以与库一起使用。
然后,您可以通过 id 从 DOM 树中检索 swf,并将变量设置在正确的对象上。
另外,您应该检查是否可以使用 FlashVars 而不是
SetVariable( )
干杯
What you need to know is that the html code you have to write to embed an swf file is different for some browsers.
Firefox and other Netscape based browsers use
<object>
tags while IE uses<embed>
tags.You can use SWFObject to embed the swf on your page.
It is a single-file, open source library that will handle all cross browser flash embedding quirks for you.
It even comes with a handy generator that will assist you in making the correct embedding code for use with the library.
You can then retrieve the swf by id from the DOM tree and set your variable on the correct object.
Also, you should check if you can use FlashVars instead of
SetVariable()
Cheers