Centering Dynamic Images in XML Gallery

Hey there folks, I’m having an issue centering dynamically loaded content, if anyone could take a look at this gallery movie I’m working on I would appreciate it.

Heres the AS for the gallery, I’m trying to center each image upon loading it into the img container.

var cx = loader._x;
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    //portfolioTag = this.firstChild;
    numimages = this.firstChild.childNodes.length;
    spacing = 50;
    for (i=0; i<numimages; i++) {
        this.picHolder = this.firstChild.childNodes*;
        this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
        this.thumbHolder._x = i*spacing;
        this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
        this.thumbHolder.title = this.picHolder.attributes.title;
        this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader._x = cx-loader._width/2;


bump, would really appreciate some help with this code. Thanks in advance!