Loop function help?

Hey Again,
I’m dealing with this bit of code that loads images via XML. I’m trying to write a loop function, but I need help. If this post is too long, let me know and I’ll post the .fla
Okay, here goes…

This is the bit of XML that defines the array:

p = 0;
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		total = xmlNode.childNodes.length;
		for (i=p; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;

This is the function that loads the first image:

function firstImage() {

And this is the function that loads the next image in the array:

function nextImage() {
	this.onEnterFrame = function() {
		if (p<(total-1)) {
		if (fadingSymbol_mc._currentframe == 1) {
			fadingSymbol_mc._alpha = 0;
			loadPic(image[p], 1);
			delete this.onEnterFrame;

It would seem that there should be another “if” statement in the “nextImage” function if I want it to loop back to the first image, right? One that says something like: if (p==(total)) then play the firstImage function. I’ve tried everything that I can think of, but no luck. Can anyone help me? :hurt: