Loading order of dynamically loaded thumbnails

Hi guys, I’m working on a portfolio site that I’m pretty much done with, but I’m having trouble with the loading order of the thumbnails on the site.

The work in the portfolio is grouped into clients, and within each client, there are thumbnails that display the selected work.

This will probably make more sense if you can see what I’m talking about:


(Only the first two clients are enabled at the moment).

Specifically, when the page is first loaded (from a web server) the thumbnails show up in the wrong order. When the page is refreshed, the thumbnails are displayed in the correct order. The thumbnails always display in the correct order when being viewed locally, or in the Flash Test Movie environment.

I’m pulling in the data from an xml file into an array, and iterating through the elements of the array with a for…next loop, I’m loading the thumbnail images with a MovieClipLoader instance. Using the onLoadInit event, I then set the horizontal position of each thumbnail clip.

I’m not necessarily looking for help with the code, as much as I’m looking for reasons why the order could be switching. I suspect it has to do with which thumbnail image finishes loading first - in which case, I’d love a suggestion on how to force the images to load in the correct order. Maybe I should use if…then and load the next thumbnail only when onLoadComplete fires?

I’d love any suggestions you guys might have.