我可以销毁使用SWFObject创建的flash对象吗?

时间:2022-05-23 19:18:58

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

我正在使用YUI的Dialog控件在弹出窗口中显示我的网站上的Flash电影。

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

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

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.

我很惊讶地看到在SWF对象常见问题中没有简单的方法来破坏电影。当YUI面板自行销毁时,它会留下一个孤立的视频播放。

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创建的SWF控件的最佳破坏方法是什么,或者没有好办法,我应该隐藏它并调用'stop()'?

1 个解决方案

#1


swfobject.removeSWF("myVideoPlayer");

--

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

编辑:这会终止您用于创建swfobject的原始

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

因此,如果您需要再次重新创建Flash,则需要插入新的占位符

<!-- 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>");

#1


swfobject.removeSWF("myVideoPlayer");

--

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

编辑:这会终止您用于创建swfobject的原始

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

因此,如果您需要再次重新创建Flash,则需要插入新的占位符

<!-- 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>");