Strange getBytesTotal behaviour on images created with GD in PHP

I was doing the flash gallery tutorial (http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) here just for fun and I’ve came across an issue I can’t resolve so I’m hoping some of you could help me out.

My issue is:

The XML file of the image list is created from DB and images are fed to flash through script which creates images on the fly with PHPs GD library. Images are shown and browsing through pictures works.

The thing not working is the preloader. the loaded bytes are never equal to total bytes so the preloader never gets shown.

When I trace the getBytesTotal inside enterFrame I get two different numbers. First two frames the total bytes equal to 4 then on the other frames function returns the right size value of the file.

This issue persist only when I feed the FLASH with GD images. If I pass the normal image file, the preloader works great.

I’m assuming the issue is when GD creates the image the fileSize is uknown. I tried getting the file size of GD created file by caching the created file, checking the filesize and passing it through headers but the preloader still won’t work and getBytesTotal still returns 4 before giving the right size… Does anybody know what the issue could be?

are you using the MovieClipLoader class? its much more robust and reliable than loadMovie or loadMovieNum… also, when are your images loading into flash? There are different loading techniques for dynamically created images… ie - if you use LoadVars to call a script that generates the image, then a loadVars preloader is required along with a loader to track the image placement after its been created.

agreed, use MovieClipLoader class.