Autoplay in xml gallery

I’d like to add an autoplay function to my xml gallery.
Here’s the Code…

spacing = 10;
containerMC._alpha = 0;
var pArray = new Array();
var tArray = new Array();
var descArray = new Array();
var cur;
MovieClip.prototype.loadPic = function(pic) {
	clearInterval(id);
	containerMC._alpha = 0;
	this.loadMovie(pArray[pic]);
	cur = pic;
	this._parent.onEnterFrame = function() {
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		bar._visible = 1;
		per = Math.round((l/t)*100);
		if (l == t && containerMC._width>0 && containerMC._height>0) {
			var w = containerMC._width+spacing, h = containerMC._height+spacing;
			border.resizeMe(w, h);
			bar._visible = 0;
			picinfo.info.text = tArray[pic];
			picinfo.desc.text = descArray[pic]; 
			delete this.onEnterFrame;
		} else {
			bar._width = per;
			//gives the bar a max width 100 
			picinfo.info.text = per+" % loaded";
			picinfo.desc.text = per+" % loaded";
		}
	};
};
MovieClip.prototype.resizeMe = function(w, h, pic) {
	trace(w);
	var speed = 3;
	this.onEnterFrame = function() {
		this._width += (w-this._width)/speed;
		this._height += (h-this._height)/speed;
		
		
		if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
			this._width = w;
			this._height = h;
			containerMC._x = this._x-this._width/2+spacing/2;
			containerMC._y = this._y-this._height/2+spacing/2;
			containerMC._alpha = 100;
			delete this.onEnterFrame;
		}
	};
};
function galleryChoice(a) {
	cur = 0;
	pArray = new Array();
	tArray = new Array();
	descArray = new Array();
	var gallery_xml = new XML();
	gallery_xml.ignoreWhite = true;
	gallery_xml.onLoad = function(success) {
		if (success) {
			var gallery = this.firstChild.childNodes[a];
			for (var i = 0; i<gallery.childNodes.length; i++) {
				tArray.push(gallery.childNodes*.attributes.title);
				pArray.push(gallery.childNodes*.attributes.source);
				descArray.push(gallery.childNodes*.attributes.desc); 
			}
			id = setInterval(containerMC, "loadPic", 100, 0);
		} else {
			title_txt.text = "Error!";
		}
	};
	gallery_xml.load("quotes.xml");
}
prevb.onRelease = function() {
	cur--;
	if (cur<0) {
		containerMC.loadPic(pArray.length-1);
	} else {
		containerMC.loadPic(cur);
	}
};
nextb.onRelease = function() {
	cur++;
	if (cur>pArray.length-1) {
		containerMC.loadPic(0);
	} else {
		containerMC.loadPic(cur);
	}
};
galleryChoice(0);
for (var i = 0; i<8; ++i) {
	var btn = this["but"+i];
	btn.id = i;
	btn.onRelease = function() {
		galleryChoice(this.id);
	};
}
stop();

Could someone help with the code for this? thanks :wink: