是否可以检测flash嵌入对象何时加载完整?是否有可以在所有浏览器中订阅该作品的活动?
谢谢, 韦斯利
答案 0 :(得分:0)
不直接,但如果您通过ExternalInterface
控制SWF,则很容易做到。首先,在SWF的flashvars中传递一个回调名称:
loadedCallback=swfLoadedCallback
此外,请确保SWF已将scriptAccess
设置为sameDomain
或all
接下来,在页面中定义回调函数:
function swfLoadedCallback() { // Note... if these were a real application, you would want // to use a setTimeout here to avoid Flash choking while // waiting for a response. alert('SWF loaded. Do something.'); }
然后,在您的SWF中,添加如下代码:
import flash.external.ExternalInterface; import flash.utils.setTimeout; var params:Object = root.loaderInfo.parameters; if (params && params.loadedCallback) { // Set timeout to avoid syncronous issues setTimeout(function():void { if (ExternalInterface.available) ExternalInterface.call(params.loadedCallback); }, 1); }