Border Resize with XML

I’m loading images in with xml and want a border to resize to each image. The image loads in, but does not center within the containerMC. The Border resizes, but all the way down the registration point.

Here is the code I am trying to make work:

// ////// XML Load Functions
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
		}
		loadImage();
	} else {
		content = "Error, the image did not load.";
		preloader._visible = false;
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pictures/pictures.xml");
// //////
p = 0;
this.onEnterFrame = function() {
	filesize = containerMC.getBytesTotal();
	loaded = containerMC.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else if (containerMC._alpha<100) {
		preloader._visible = false;
		containerMC._alpha += 10;
	}
};
// //////
function loadImage() {
	if (loaded == filesize) {
		containerMC._alpha = 0;
		containerMC.loadMovie(image[random(total)], 1);
		var w = containerMC._width+spacing, h = containerMC._height+spacing;
		border.resizeMe(w, h);
		delete _root.onEnterFrame;
	}
}
// //////
spacing = 20;
containerMC._alpha = 0;
// //////
MovieClip.prototype.resizeMe = function(w, h) {
	var speed = 10;
	this.onEnterFrame = function() {
		this._width += (w-this._width)/speed;
		this._height += (h-this._height)/speed;
		if (Math.abs(this._width-w)<1) {
			this._width = w;
			this._height = h;
			_root.containerMC._x = this._x-this._width/2+spacing/2;
			_root.containerMC._y = this._y-this._height/2+spacing/2;
			_root.containerMC._alpha = 100;
			delete this.onEnterFrame;
		}
	};
};
// //////
stop();

anyone know what I’m missing? thanks.