R – determine when sifr is done

sifr

How can I determine that sifr is finished running? I need to know the height of an element where there is sifr text on page load, but when I check the height, sifr has not yet completed and I get an incorrect value (the height of the element before sifr has been applied). And I definitely want to avoid having to place an arbitrary delay in finding the height. Any suggestions?

Best Answer

You could use the onReplacement callback, which is invoked each time an element is replaced. It's specified as an argument to sIFR.replace(), more here: http://wiki.novemberborn.net/sifr3/JavaScript+Methods.

From there on you'd use the FlashInteractor object, which is passed as the first argument, to get to the replaced element.

Do note though that when the page resizes, the text could wrap, changing the height of the Flash movie. There is no callback for this.