reload/ reset embedded swf on click

Deadly 提交于 2019-12-06 08:02:56

问题


I have various flash movies in tags on my page. Is there any way on click of a button (html) I can restart/ reload the embedded flash movie?

Im using:

<object data="flash/cvdb_video_cvdb_access.swf" type="application/x-shockwave-flash" id="flash_99674493" width="680" height="316">
<param name="movie" value="flash/cvdb_video_cvdb_access.swf">
<param name="wmode" value="opaque">
</object>

Thanks!


回答1:


You can use jQuery to take all the HTML from the previous <object.. element, and just inject the html back into it, as there is no way to "reload" an individual element. you reload locations, and the entire dom, but you don't want that. you just want to reload your swf.

var obj = $("object#flash_99674493");
var orig = obj.html();

var restart = function() {
    obj.html(orig);
    alert("reloaded");
}

see (this jsfiddle)




回答2:


Yes, you can. Using your object (... id="flash_99674493"...) example you could:

var elem = $("#flash_99674493")[0]; 
elem.reload(); 

As you tagged your question, I am using jQuery.



来源:https://stackoverflow.com/questions/15505972/reload-reset-embedded-swf-on-click

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