Counting XML Nodes

Hello, I’ve got a few issues with something Im working with here, but I’ll just do one at a time.
I am attempting to create a Flash Banner for my bands website and I am trying to include some information about future gig’s that my band may be performing along the bottom, just [COLOR=“Indigo”]Date[/COLOR] and [COLOR=“Plum”]Location[/COLOR] as of now, the way I am currently doing this is by having each child node of root node in the XML file numbered:

[COLOR="YellowGreen"]function loadXML(loaded) {
if (loaded) {
if (n >= 1) {
_root.GigTxt.dtMov.dtTxt.text =;
_root.GigTxt.lcMov.lcTxt.text = _root.location; = this.firstChild.childNodes[n].childNodes[0].firstChild.nodeValue;
_root.location = this.firstChild.childNodes[n].childNodes[1].firstChild.nodeValue;[/COLOR]

Let me clear this up a bit, I start my timeline with the following action, “n = 0”. and then want some script to count how many nodes the Root node in my XML file has as children, which I then want to return as a value which I can call “nTot” (Shortened from Node Total).

I also have codes in my .fla file which determine which node should be displayed at which time. For instance:

if (nTot <= 0) {
	n = 0;
} else if (n < nTot && nTot >= 1) {
	n = n + 1;
if (n > nTot) {
	n = 1;

Please bare in mind at this time that I want The First Child of the root node in my XML file to display “No Gigs Planned” thats why if nTot is 0 nothing but the First Child of the Root Node will be shown. I hope this all makes sense. Please help.

Right now I would just like some assistance in creating a code that will count nodes in an XML file and then return a value to be known as “nTot” (can someone tell me the technical term for this method, replacing a value with a word/letter?)

Thanks in advance for your help!

P.S: Whenever I view the swf file, There always seems to be some form of margin formed,… why!?