0

I'm using swfobject to dynamically load a flash object into a div, and I'm wondering if there's an easy way to display a loading animation until the flash object is ready for display? In this case, I'm loading an embedded Issuu object, and you can see an example of Issuu loading via swfobject here. Depending on your connection speed, there is typically just a blank white space while the flash object loads, and it'd be great to indicate progress with a loading animation if possible. I would imagine jQuery could be of service here...

Thanks for any direction here.

3
  • Put your Loading code on the first frame of the SWF. It should display before the full movie has loaded. Commented Mar 18, 2011 at 0:23
  • thanks jnpcl-- only thing is that I have not authored the SWF as it comes from Issuu; the objects can be manipulated via an API but I don't think I can actually insert a frame Commented Mar 18, 2011 at 0:52
  • hmm.. how about creating a container file with a loading animation, which loads & plays the actual SWF? Commented Mar 18, 2011 at 7:15

1 Answer 1

1

In your embed code, you not only pass an id of the tag you want to be replaced by the swf (idOfTagToReplace), but also an id of the tag replacing it (issuuViewer). Right after your call to swfobject, style the latter tag as you like.

var attributes = {
    id: 'issuuViewer'
};

var params = {
    allowfullscreen: 'true',
    menu: 'false',
    wmode: 'transparent'
};

var flashvars = {
    jsAPIClientDomain: 'www.yourdomain.dk',
    mode: 'mini',
    documentId: '081219132433-764a1eafce5141fda136d10d58bd45f5'
};

swfobject.embedSWF(
    "http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf", 
    "idOfTagToReplace", 
    "420", 
    "264", 
    "9.0.0",
    "swfobject/expressInstall.swf", 
    flashvars, 
    params, 
    attributes
);

var obj = document.getElementById('issuuViewer');
obj.style.backgroundImage = 'url(/img/loading.gif)';
obj.style.backgroundRepeat = 'no-repeat';
obj.style.backgroundPosition = '50% 50%';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.