_width not reading initially

Im modifying an xml slideshow code from:

http://www.republicofcode.com/tutorials/flash/slideshow/6.php

Because my images are going to be different sizes I am working on ceterning into a fixed stage. However, for some reason, the first slide doesn’t read the width/height for some reason so I can’t calculate how to center it. Any ideas?


import mx.transitions.Tween;
import mx.transitions.easing.*;

var xmlfile = xmlfile;


var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load(xmlfile);

myShowXML.onLoad = function() {
    // GET THE WIDTH/HIEGHT/SPEED INTO VARS
    _root.myWidth = myShowXML.firstChild.attributes.width;
    _root.myHeight = myShowXML.firstChild.attributes.height;
    _root.mySpeed = myShowXML.firstChild.attributes.speed;

    // load the images and image count into vars
    _root.myImages = myShowXML.firstChild.childNodes;
    _root.myImagesNo = myImages.length;
    
    // create the moviecliploader
    createContainer();
    
    // LOAD THE IMAGES
    callImages();

};


function createContainer() {
    // create a movieclip called myContainer_mc
    _root.createEmptyMovieClip("myContainer_mc",1);

    
    //CREATE BORDER AROUND MOVIECLIP
    myContainer_mc.lineStyle(5,0x000000,100);
    myContainer_mc.lineTo(_root.myWidth,0);
    myContainer_mc.lineTo(_root.myWidth,_root.myHeight);
    myContainer_mc.lineTo(0,_root.myHeight);
    myContainer_mc.lineTo(0,0);
    
    
    
    //SOMETHING ABOUT CENTERING THE MOVING CLIP IN THE STAG
    // WE DONT NEED THIS BECAUSE MOVIE CLIP IS SAME SIZE AS STAGE
    
    myContainer_mc._x = (Stage.width-myContainer_mc._width)/2;
    myContainer_mc._y = (Stage.height-myContainer_mc._height)/2;
    
    
}

function callImages() {
    
    // CREATE A NEW MOVIECIPLOADER
    _root.myMCL = new MovieClipLoader();
    
    // create a listener for the moviecliploader
    _root.myPreloader = new Object();
    _root.myMCL.addListener(_root.myPreloader);
    
    // AN ARRAY TO HOLD THE CLIPS
    _root.myClips_array = [];

    _root.myPreloader.onLoadStart = function(target) {

        _root.createTextField("myText_txt",_root.getNextHighestDepth(),0,0,100,20);
        //_root.myText_txt._x = (Stage.width-_root.myText_txt._width)/2;
        //_root.myText_txt._y = (Stage.height-_root.myText_txt._height)/2;
        _root.myText_txt.autoSize = "center";

        _root.myText_txt.text = "test";

    };

    _root.myPreloader.onLoadProgress = function(target) {

        _root.myText_txt.text = "Loading.. "+_root.myClips_array.length+"/"+_root.myImagesNo+" Completed";

    };


    _root.myPreloader.onLoadComplete = function(target) {
        // WHEN A CLIP IS LOADED, ADDED IT TO MYCLIPS ARRAY
        _root.myClips_array.push(target);
        
        // MAKE THE TARGET CLIP INVISIBLE
        target._alpha = 0;


        if (_root.myClips_array.length == _root.myImagesNo) {

            //_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
            _root.target_mc = -1;
            
            setTimeout(
            // execute the first load
            moveSlide();
            
            // CREATE THE INTERVAL FOR MOVESLIDE
            myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000);


        }

    };

    for (i=0; i<_root.myImagesNo; i++) {
        // LOOP THROUGH THE IMAGES AND LOAD THEM AS A MOVIECLIP
        
        // ASSING THE URL AND IMAGE TO VARS
        temp_url = _root.myImages*.attributes.url;
        temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth());
        
        // load into our movie clip
        _root.myMCL.loadClip(temp_url,temp_mc);
    }

}


function moveSlide() {

    // CURRENT CLIP
    current_mc = _root.myClips_array[_root.target_mc];
    
    // fade out current clip
    new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 1, true);

    // INCREMENT CURRENT CLIP
    _root.target_mc++;
    
    // IF TARGET CLIP IS MORE THAN TOTAL, RESET TO 0
    if (_root.target_mc>=_root.myImagesNo) {
        _root.target_mc = 0;
    }
    
    
    
    
    // NEXT CLIP
    next_mc = _root.myClips_array[_root.target_mc];
    next_mc._x = (Stage.width - next_mc._width) / 2;
    next_mc._y = (Stage.height - next_mc._height) / 2;
    
    _root.myText_txt.text = _root.target_mc+"   Stage: "+Stage.width+"x"+Stage.height+"  Slide: "+next_mc._width+"x"+next_mc._height;

    // fade in next clip
    new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);

}