Can I destroy a Flash object created with SWFObject?

I use the YUI Dialog control to display a Flash movie on my site in a popup window.

I am creating a flash control using SWFObject . This creates an instance of JW Player for my video.

I was very surprised to see that there is no easy way to destroy a movie in the SWF Object FAQ . When the YUI panel destroys itself, it leaves the game with an orphan.

What is the best way to destroy a SWF control created with SWFObject, or is there no good way, and I just have to hide it and call "stop ()"?

+3
source share
1 answer

swfobject.removeSWF ("myVideoPlayer");

-

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

So, if you need to create Flash again, you will 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>");

+13
source

Source: https://habr.com/ru/post/1706506/


All Articles