onClipEvent enterFrame stop loop problem

I wasn’t sure how to name this thread to well. Ah well. Here’s my funk:
I have made a photo slide show and all works well for browsing and viewing. Where I got stuck was when I tried to write code that would center images that were vertical. This is the entire code on the empty mc that has it preload, display then adjust the x of the image. Now, with this code if the image is vertical it flies off the right of the page. haha. sounds fun eh?


onClipEvent (enterFrame) {
	total_bytes = this.getBytesTotal();
	loaded_bytes = this.getBytesLoaded();
	remaining_bytes = total_bytes-loaded_bytes;
	percent_done = int((loaded_bytes/total_bytes)*100);
	_root.loaderim.gotoAndStop(percent_done);
	if (total_bytes == loaded_bytes) {
		if (this._width<this._height) {
				this._x = this._x+(this._width/2);
		} else {
			this._x = 149.8;
		}
	}
}

I’ve been playing around with a few alternatives to stop the loop once it has changed the _x position but haven’t figured out the best way. I’ll figure it out sooner or later but i find whenever i post on here someone tends to beat me :smirk:. Ok, well thanks in advance to anyone who can help out. The race is on! :bad: