如何判断swf何时从javascript加载?

时间:2013-01-10 17:23:44

标签: javascript actionscript-3 flash

我需要知道我的swf何时准备开始播放(例如,初始加载器已完成下载)。我知道我可以在swf中的ExternalInterface.call('someJSFunc')处理程序中使用[loader][1],但如果可能的话,我宁愿没有那种依赖。

JS内部有更好的方法吗?到目前为止,我唯一想到的就是:

// continually check if the flash is ready
var int = setInterval(function(){
    var fl = $('#flashMovie').get(0);
    if (fl) {
        doThings();
        clearInterval(int);
    }
}, 50);

1 个答案:

答案 0 :(得分:1)

swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes, callbackFn)

不确定这是否对您有所帮助,但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)

更多信息here