XML Flash Gallery breakthrough

…needed!

I have been struggling with this for a couple of days now and i can’t seem to get it to work just like i want it to (does it ever? :wink: )

Anyhow, this is my problem:

I have a nicely transitioning xml gallery…i have a tab with dynamicly loaded text that slides in when a new image is loaded into the gallery.
Just as a new image is being loaded into the gallery the tab needs to slide out again, change text and slide in again when the image is loaded. I have it up to the tab sliding in and dynamic text is loaded into the tab. But when the new image is laoding the tab just disappears, just to have it slide in with new text after that!

stop();
var id, current;
var k = 0, p = 0;
var slide = 1;
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
			description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
		}
		id = setInterval(preloadPic, 100);
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
function preloadPic() {
	
	MovieClip.prototype.fadeIn = function() {
		if (this._alpha<100) {
			current._alpha -= 5;
			this._alpha += 5;
			
		} else {
			ease(test, 147);
			trace("up");
			current._visible = 0;
			current = this;
			delete this.onEnterFrame;
		}
	};
	function nextImage() {
		ease(test, 180);
		trace("down");
		p<total-1 ? p++ : p=0;
		test.desc_txt.text = description[p];
		picture_num();
		preloadPic();
	}
	function picture_num() {
		current_pos = p+1;
	}
	clearInterval(id);
	var con = picture.duplicateMovieClip("con"+k, 9984+k);
	con.loadMovie(image[p]);
	preloader._visible = 1;
	//preloader.swapDepths(con.getDepth()+3);
	var test = tester.duplicateMovieClip("test"+k, 9985+k);
	con._alpha = 0;
	var temp = _root.createEmptyMovieClip("temp"+k, 99+k);
	k++;
	temp.onEnterFrame = function() {
		var total = con.getBytesTotal();
		var loaded = con.getBytesLoaded();
		percent = Math.round(loaded/total*100);
		preloader.preload_bar._xscale = percent;
		if (con._width) {
			preloader._visible = 0;
			con.onEnterFrame = fadeIn;
			test.desc_txt.text = description[p];
			if (slide) {
				id = setInterval(nextImage, 4000);
			}
			delete this.onEnterFrame;
		}
	};
}
var speed = 2;
ease = function (what, to) {
	what.onEnterFrame = function() {
		var distance = to-this._y;
		var newDistance = distance/speed;
		this._y = to-newDistance;
	};
};
preloadPic();

ease = function(etc){ is the function to look out for

Could any of you tackle this problem? I can’t seem to point to where i went wrong!

many thanks in advance.

Plaz