Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COHi Chazbot. I've had a go with your suggestion. Firstly, your EDIT seems correct. It seems that as soon as the OBJECT gets created on the page (which holds the Adobe Flash Player), swfobject fires its callbackFunction. i.e. it fires before the swf has loaded, and so I can't use this callbackFunction. So, I've managed to find onReady events for each of the 3rd party swf's and had a go with these.
      singulars
    2. COUnfortunately, it seems that using jquery's hide() function, essentially does a CSS display:none, and it turns out that this stops or blocks the flash object. The onReady events never fire. Reading around on the net it seems this may even be by design. The following post suggests instead of using a display:none, you can set a div that contains the flash object to CSS width:1px; height 1px; overflow:hidden .... http://www.stoimen.com/blog/2009/04/14/load-flash-swf-in-hidden-div/ .... and then when the onReady event fires, set the size back up to full size.
      singulars
    3. COAlthough, this approach has succesfully allowed my to display a loading image while the swf is loading, it has an unforseen consequence in that for users who are using the Firefox Flashblock plugin (which stops any Flash playing until you press the Flashblock play button), they don't see the Flashblock play button as it is inside the div that is 1px by 1px. This means for these users it just looks like the page is broken.
      singulars
 

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