[英]How to tell when a swf has finished loading from javascript?
I need to know when my swf is ready to start playing (eg the initial loader has finished downloading). 我需要知道我的瑞士法郎何时可以开始播放(例如,初始加载程序已完成下载)。 I know I can use ExternalInterface.call('someJSFunc')
in a [loader][1]
handler within the swf, but if possible, I'd rather not have that dependency. 我知道我可以在swf中的[loader][1]
处理程序中使用ExternalInterface.call('someJSFunc')
,但如果可能的话,我宁愿不要使用该依赖项。
Is there better a way just within JS? 仅在JS中有更好的方法吗? The only thing I've come up with so far is something like: 到目前为止,我想出的唯一一件事是:
// continually check if the flash is ready
var int = setInterval(function(){
var fl = $('#flashMovie').get(0);
if (fl) {
doThings();
clearInterval(int);
}
}, 50);
swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes, callbackFn)
Not sure if this will help you but the last parameter to swfobject is a callback function that gets called when the swf tag is created. 不确定是否对您有帮助,但是swfobject的最后一个参数是在创建swf标记时调用的回调函数。
callbackFn (JavaScript function, optional) can be used to define a callback function that is called on both success or failure of creating a Flash plug-in <object> on the page (see API documentation)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.