[flashcs3] Photogallery needs refining

I’ve gone through several tutorials and managed to create a photogallery far beyond what I thought I was capable of. (yay!) While it has all the features I could want (thumbnails in a nice scrolling grid, slideshow option, etc) I’ve reached a couple of vital stumbling blocks.

a) centering the first image.

_root.createEmptyMovieClip("fullImage_mc", _root.getNextHighestDepth());
fullImage_mc._x = 100 + ((Stage.width-fullImage_mc._width)/2);
fullImage_mc._y = (Stage.height-fullImage_mc._height)/2;

This works perfectly for all subsequent images, but the first one is displayed wrong. This is because Flash doesn’t know the image’s height or width before it’s loaded. However, if I change these locations to something static, there’s a flicker when loading the other images, where the image is first loaded at the static location, then moved to the center.

b) positioning the preloader. Obviously I’d like this to be centered, but the more I’ve played with it, the worse it gets.

fullPreloader.onLoadStart = function(target) {
        var myFormat:TextFormat = new TextFormat();
        myFormat.font = "Geneva";
        myFormat.size = 36;
        myFormat.align = "center";
        myFormat.color = _root.mycolor;
        target.createTextField("my_txt",target.getNextHighestDepth,0,0,400,100);
        target.my_txt.selectable = false;
        target.my_txt.setNewTextFormat(myFormat);
    };

This is a secondary issue and at the moment I’ve just moved it to the top left of the image. If anyone has good advice that would be great, otherwise I may just hide the preloader.

c) slideshow doesn’t wait for images to load. So with large images/slow connections the slideshow will move on to the next image before the current one has loaded. My initial solution was to load the next image in a hidden mc whenever an image is loaded and while this kind of works, there are still issues when there are lots of images in the gallery. I’ve removed this attempt from the attacted file.

What do you think? Is there any hope? Thanks for your help!