Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Without knowing which 3rd party swfs you're using it could be tough, but here's a few things to think about:</p> <p>One approach would be to hide the swf (or the div that the swf is inside) until it's loaded, and then reveal it once it's finished. You can have a spinner / loading image sit in it's place in the mean time. That said, what you really need is a javascript function that gets called once the load is complete. Once this happens, you can use jQuery to <code>.show()</code> or <code>.hide()</code> your spinner and swf respectively.</p> <p>JWPlayer has some <a href="http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference#Events" rel="nofollow">events that you can make use of</a>. It looks like <code>onReady</code> would do the trick for you.</p> <p>As for the other 3rd party swfs, I'd look around their documentation for similar javascript callbacks. I know the <a href="http://code.google.com/p/swfobject/wiki/api" rel="nofollow">swfobject has an onLoad callback</a>, as do a few other embed solutions like <a href="http://www.mootools.net/docs/core/Utilities/Swiff" rel="nofollow">Swiff</a>, assuming you can use them.</p> <p>Good luck!</p> <p>EDIT: The swfobject's callback might be called when the swf has successfully been <em>embedded</em> not necessarily <em>loaded</em>. Your best bet is to play around with this and see if it works - or use the 3rd party swf's callback functions wherever possible.</p> <p>EDIT 2: Here's a flash loader example. </p> <pre><code>import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; function startLoad() { var mLoader:Loader = new Loader(); var mRequest:URLRequest = new URLRequest("url-to-your-swf.swf"); mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); mLoader.load(mRequest); } function onCompleteHandler(loadEvent:Event){ addChild(loadEvent.currentTarget.content); //Here's where you specify your js function ExternalInterface.call("flashLoaded"); // &lt;-- where 'flashloaded' is a js function } startLoad(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload