sIFR height issue
Even though sIFR 3 has been out for ages, there are still a lot of folks using version 2. It still works quite nicely, but yesterday I came across a very strange bug that, as far as I can tell, derives from Flash rather than the sIFR code.
If you haven’t a clue what I’m talking about, sIFR is an extremely useful technique that lets you overlay your standard text with pretty fonts, via a dynamically-created Flash movie. Version 2 calculates the font size to use within the movie from the dimensions of the original container element.
For some reason, the font I was using, combined with a specific length of text, was bringing back an incorrect font size. The movie dimensions were fine, but the text simply wasn’t filling the available space. Adding or removing a few characters was fine.
I solved this very odd behaviour by delving in to the ‘dont_customise.as’ Actionscript file that comes with the sIFR download (I was using 2.0.7 but this fix may work for other versions too). Look for the following around line 115:
holder.txtF._height = orig_height;ismax = holder.txtF.maxscroll;breaker1++;
Add in the following line underneath:
var foo=holder.txtF.textHeight; // fix the weird height issue!
All this does is access the holder.txtF.textHeight property, but it seems to be enough to kick Flash into rendering the correct font size for the calculated height. Now save and export your SWF files again – simple!
You mean the worst inconsistency has been a Flash bug all along? Argh!
(Still, using text length and boxes to arrive at a font size? Bad idea…)
October 3rd, 2009 at 3:53 pmYeah, sIFR 3 takes a much better approach. Even then, I try to avoid it whenever I can.
October 3rd, 2009 at 3:54 pm