Posted by & filed under Developer Blog.

I’ve been using an image pre-loader that I wrote myself for several years now, whenever I need to load an external jpeg into my movie. I’ve also been in the habbit of re-naming my .jpg images to .jjj in order to trick AOL’s image compression “feature.”

What I never expected is that AOL would also find a way to break my pre-loader! As far as I can tell, AOL is somehow and for some reason tacking on an extra kilobyte or so to the actual size of my images.

Like most pre-loaders, I am looping through looking at the total bytes loaded and comparing that with the total bytes. The problem is that in AOL (I’ve only tested 9.0 “Security Edition”) when the image has loaded what appears to be 100% of the image, the total bytes loaded is larger than the total bytes. Since my pre-loader was set to fade in the image when total kilobytes loaded was equal to total kilobytes (kbl==tkb), my pre-loader would hang waiting for them to be equal when in fact they were not. I assume that more than one kilobyte was loading everytime my script would loop, and therefore never registered the exact number equal to tkb it just skipped on past.

To fix this problem, I changed my script to fade the image in when the total kilobytes loaded was equal to or greater than the total kilobytes (kbl>=tkb) and the problem went away.