Is it possible to detect when a Flash embed object has loaded completely? Are there events that can be subscribed to that work in all browsers?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not directly, but it’s easy to do if you have control over the SWF via
ExternalInterface. First, in the flashvars for the SWF pass a callback name:loadedCallback=swfLoadedCallbackAdditionally, be sure the SWF has
scriptAccessset tosameDomainorallNext, Define a callback function in your page:
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.'); }Then, in your SWF, add code like this:
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); }