XML Function on keypress

Hi, I have the following actions in my root.


function loadXML(loaded) {
	if (loaded) {
		//main window
		_root.news = this.firstChild.childNodes[x].childNodes[2].firstChild.nodeValue;
		_root.ntitle = this.firstChild.childNodes[x].childNodes[0].firstChild.nodeValue;
		_root.date = this.firstChild.childNodes[x].childNodes[1].firstChild.nodeValue;
		_root.stuff.newsMainWindow.text = _root.news;
		_root.stuff.newsMainTitle.text = _root.ntitle;
		_root.stuff.newsMainDate.text = _root.date;
		//left bar
		_root.subText1 = this.firstChild.childNodes[y].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews1.text = _root.subText1;
	
		_root.subText2 = this.firstChild.childNodes[y+1].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews2.text = _root.subText2;
		
		_root.subText3 = this.firstChild.childNodes[y+2].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews3.text = _root.subText3;
		
		_root.subText4 = this.firstChild.childNodes[y+3].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews4.text = _root.subText4;
		
		_root.subText5 = this.firstChild.childNodes[y+4].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews5.text = _root.subText5;
		
		_root.subText6 = this.firstChild.childNodes[y+5].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews6.text = _root.subText6;
		
		_root.subText7 = this.firstChild.childNodes[y+6].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews7.text = _root.subText7;
		
		_root.subText8 = this.firstChild.childNodes[y+7].childNodes[0].firstChild.nodeValue;
		_root.stuff.subNews8.text = _root.subText8;
	} else {
		trace("file not loaded!");
	}
}

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

And then in the Stuff movie clip (I really need to work on naming my MC’s :P) I have a button, when I press that button, it increments _root.x by one I need to reload the XML information to the second firstchild.


on(press)
{
	_root.x = _root.y+1;
	trace(_root.x);
}

And Finally, The XML.


<newsfeed>
-
	<new>
<title>Site Updated</title>
<date>30/12/04</date>
-
	<news>
I have finally updated this site to use a flash interface
</news>
</new>
-
	<new>
<title>Site Not Updated</title>
<date>30/11/04</date>
<news>lalalalala</news>
</new>
</newsfeed>

Any help is greatly appreciated.

Just to make sure everyone knows what I want to do, is reload the XML data when X=1, if X=0 then it works fine (with the “Site Updated” news) but I am not sure how to get the data again for “Site Not Updated”.

Cheers, Gazler.

UPDATE, I got this working eventually :slight_smile: