# Cycle through my XML, almost done - anyone spot the problem?

**URL:** <https://forum.kirupa.com/t/cycle-through-my-xml-almost-done-anyone-spot-the-problem/166135>\
**Category:** flash\
**Created:** [October 17, 2005, 10:38am UTC](https://forum.kirupa.com/t/cycle-through-my-xml-almost-done-anyone-spot-the-problem/166135 "2005-10-17T10:38:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevorsaint](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/trevorsaint/32/268_2.png) [@trevorsaint](https://forum.kirupa.com/u/trevorsaint)\
**Post date:** [October 17, 2005, 10:38am UTC](https://forum.kirupa.com/t/cycle-through-my-xml-almost-done-anyone-spot-the-problem/166135/1 "2005-10-17T10:38:51Z")

</div>

My button script is as follows:

```auto

on (press) {
	if (xmlNode + 1 == xmlNode.total) {
		xmlNode = 0;
	} else {
		xmlNode += 1;
	}
	_root.xmlData.load("home.xml");
}

```

My Xml is as follows:

```auto

//Flash variables

//XML Interaction with Flash
function loadXML(loaded) {
	
	if (loaded) {
		
		xmlNode = this.firstChild;

		//For loop
		for (i=0; i<total; i++) { total = xmlNode.childNodes.length; }
		
		client = xmlNode.firstChild.attributes.number;
		company = xmlNode.childNodes*.childNodes[0].attributes.name;
		photo = xmlNode.childNodes*.childNodes[0].attributes.photo;
		swf = xmlNode.childNodes*.childNodes[0].attributes.swf;
		involvement = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
		description = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
		url = xmlNode.childNodes*.childNodes[3].attributes.link;
		
		//Output total of clients in XML
		xmlTotal = xmlNode.childNodes.length;
				
		/*External Flash Load AS*/
		_root.createEmptyMovieClip("swfMC",1);
		swfMC.loadMovie(swf);
		swfMC._y = 10; //y position
		swfMC._x = 0; //x position
						
		/*External Image Load AS
		_root.createEmptyMovieClip("image_mc",1);
		image_mc.loadMovie(photo);*/
		
		//Trace ('file loaded successfully');
		note = "file loaded successfully";
	} else {
		//Trace ('error loading file');
		note = "error loading file";
	}
}

//XML Properties
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("home.xml");

stop();

```

But its not cycling through on click, can anyone spot the problem???
