我可以销毁用SWFObject创建的Flash对象吗? [英] Can I destroy a flash object created with SWFObject?

查看:272
本文介绍了我可以销毁用SWFObject创建的Flash对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用 SWFObject 。这会为我的视频创建一个 JW Player 实例。



我很惊讶地发现在 SWF Object FAQ 。当YUI面板破坏时,会留下一个孤立的视频播放。



什么是使用SWFObject创建的SWF控件的最佳方式,或者没有好方法而我应该只是隐藏它,而不是调用停止()?

解决方案

swfobject.removeSWF(myVideoPlayer);

-



编辑 c>< DIV> 您首先创建了swfobject。所以如果你需要重新创建Flash,需要插入新的占位符< DIV>

  <! - 您需要将myVideoPlayerDIV包装到另一个DIV中 - > 
< div id =videoPlayerWrapper>
< div id =myVideoPlayer/>
< a href =#class =close>关闭播放器< / a>
< / div>

swfobject.removeSWF(myVideoPlayer);
$('#videoPlayerWrapper')。prepend(< div id ='myVideoPlayer'>< / div>);


I am using YUI's Dialog control to show a Flash movie on my site in a popup.

I am creating the Flash control using SWFObject. This creates a JW Player instance for my video.

I was quite surprised to see no easy way to destroy the movie in the SWF Object FAQ. When the YUI panel destroys itself it leaves an orphaned video playing.

What is the best way to destory a SWF control that was created with SWFObject, or is there no good way and I ought to just hide it instead and call 'stop()' ?

解决方案

swfobject.removeSWF("myVideoPlayer");

--

Edit: this kills off the original <DIV> that you used to create the swfobject in the first place.

So if you need to recreate the Flash again you'll need to insert a new placeholder <DIV>.

<!-- you'll need to wrap the 'myVideoPlayer' DIV in another DIV -->
<div id="videoPlayerWrapper">
   <div id="myVideoPlayer"/>
   <a href="#" class="close">Close Player</a>
</div>

swfobject.removeSWF("myVideoPlayer");
$('#videoPlayerWrapper').prepend("<div id='myVideoPlayer'></div>");

这篇关于我可以销毁用SWFObject创建的Flash对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆