Help centering a dynamically loaded jpg

I’m trying to center a dynamically loaded jpeg to the stage. The jpegs are loaded via xml to a movie clip called ‘picture’. I have the code below which works fine on my computer, however, when trying it on a live server I sometimes get a problem where instead of centering the image, the image ends up with its left edge aligned to the center - which suggests that the code didnt get the image width properly. This only happens sometimes, not all the time so must be something to do with how its loading. Code below - any ideas please?! (code is partly based on xml slideshow found on here somewhere)

this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader._visible = true;
	
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
			desc_txt._alpha += 10;
			picture._x = 575-(_root.picture._width/2)+0;
			desc_txt._x = 575-(_root.picture._width/2)+0;
		}
	}
	};