Can I destroy a flash object created with SWFObject?

Deadly 提交于 2019-12-07 16:10:50

问题


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()' ?


回答1:


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



来源:https://stackoverflow.com/questions/754895/can-i-destroy-a-flash-object-created-with-swfobject

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!