Center Dynamically Loaded JPGs of dif sizes

Hi All, I’ve read a few of the other threads on this subject but still had no luck. I’m loading jpgs via an xml file and the pics are all diffrent sizes. I’m trying to figure out how to center the image once loaded, but am running into brick wall after brick wall. Can anyone please help. This is not my code - i’m not at a point where i can write something like this myself - hence the confusion.

thanks in advance!

here’s the code:

this.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
//container_mc._x=(Stage.width - container_mc._width)/2;
//container_mc._y=(Stage.height - container_mc._height)/2;
	
//container_mc._x = 80;
//container_mc._y = 20;


content = container_mc;
images_xml = new XML();
images_xml.onLoad = startImageViewer;
images_xml.load("images.xml");
images_xml.ignoreWhite = true;
function startPreloading(content) {
	preloader_mc._visible = true;
	preloader_mc.bar._xscale = 0;
	interval = setInterval(checkProgress,10, content);
}

function checkProgress(content) {
	var contentSize = 0;
	var contentLoaded = 0;
	var loaded = 0;
	contentSize = content.getBytesTotal();
	contentLoaded = content.getBytesLoaded();
	loaded = Math.ceil(contentLoaded / contentSize * 100);
    preloader_mc.bar._xscale = loaded;
	updateAfterEvent();
	if (contentLoaded == contentSize && contentSize > 0) {
		clearInterval(interval);
		preloader_mc._visible = false;
		
	}
	
}

function updateImage(newImageNode) {
	startPreloading(content);
	url = newImageNode.attributes.jpegURL;
    description = newImageNode.firstChild.nodeValue;
	description.htmlText;
    container_mc.loadMovie(url);
	
	
}

function startImageViewer(success) {
	        rootNode = images_xml.firstChild;
			totalImages = rootNode.childNodes.length;
			firstImageNode = rootNode.firstChild;
			currentImageNode = firstImageNode;
			currentIndex = 1;
			updateImage(firstImageNode);
			
}

next_btn.onRelease = function() {
	nextImageNode = currentImageNode.nextSibling;
	if (nextImageNode == null) {
		break;
	} else {
		currentIndex++;
		updateImage(nextImageNode);
		currentImageNode = nextImageNode;
	}
};

prev_btn.onRelease = function() {
	previousImageNode = currentImageNode.previousSibling;
	if (previousImageNode == null) {
		break;
	} else {
		currentIndex--;
		currentImageNode = previousImageNode;
		updateImage(previousImageNode);
	}
};

just in case anyone runs across this with the same question, i figured it out. the jpg has to fully load before it can be centered, so this code works better for laoding/preloading the pix - and i actually wrote most of it myself =)

function updateImage(newImageNode) {
	//startPreloading(content);
	this.createEmptyMovieClip("imageHolderMC", 1);
	url = newImageNode.attributes.jpegURL;
    description = newImageNode.firstChild.nodeValue;
	this.createEmptyMovieClip("imageHolderMC", this.getNextHighestDepth());
	var loaderMC:MovieClipLoader = new MovieClipLoader();
	loaderMC.loadClip(url, imageHolderMC);
	var oListener:Object = new Object();
	oListener.onLoadInit = function() {
		centerImage();
		
	}
	
	loaderMC.addListener(oListener);

	oListener.onLoadProgress = function(imgeMC:MovieClip, loadedBytes:Number, totalBytes:Number) {
  	pText.text = "LOADING " + Math.round(loadedBytes / totalBytes*100) + "%";
	};
}



function centerImage() {
	imageHolderMC._x = Stage.width/2 - imageHolderMC._width/2;
	imageHolderMC._y = Stage.height/2 - imageHolderMC._height/2 - 50;
	pText.text = "";
	
}