[F8] Need help reading messages from an XML file and looping through them

Hi all
Grateful for any help with this problem which I have done before, but unfortunately no longer have the FLA file. The idea is to have a web page header that has some eye-catching animated messages that keep changing to the next one after a few seconds.

An XML file (header-messages.xml) contains one line per message, and also a hyperlink, see example below

[FONT=Courier New]<?xml version=“1.0”?>[/FONT]
[FONT=Courier New]<config>[/FONT]
[FONT=Courier New]<message1 lineOne=“Special offer on red widgets” hyperLink="/special-offer.htm" />[/FONT]
[FONT=Courier New]<message1 lineOne=“Read our latest news” hyperLink="/latest-news.htm" />[/FONT]
[FONT=Courier New]<message3 lineOne=“Offer of the month is 2 for 1 on blue widgets” hyperLink="/monthly-promotion.htm" />[/FONT]
[FONT=Courier New]</config>[/FONT]

What I would like to do is:

// Load the XML file, using a function to ensure it is loaded before reading the data from it
// Variables are set by the in built XML object in Flash to be e.g. _root.message1 etc. (Or something!?)
// Initialise a counter at zero
// The first frame of the timeline is used to increment the counter and set the txt field to be the first variable, e.g. message1, then message2 etc.
// Loop through for as many times as there are messages in the xml file
// If we only have 3 messages, there would be no message4, so if there is nothing in message4 we can set the counter back to 0

I’m just not sure how exactly to do this.

Any help on how to acheive this most appreciated.

This is kind of what I was thinking, although it clearly doesn’t loop through anything:

[FONT=Courier New]function loadXML(loaded) { [/FONT]
[FONT=Courier New]if (loaded) { [/FONT]
[FONT=Courier New]_root.message1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; [/FONT]
[FONT=Courier New]message_txt.text = _root.message1; [/FONT]
[FONT=Courier New]} else { [/FONT]
[FONT=Courier New]trace(“file not loaded!”); [/FONT]
[FONT=Courier New]} [/FONT]
[FONT=Courier New]} [/FONT]
[FONT=Courier New]xmlData = new XML(); [/FONT]
[FONT=Courier New]xmlData.ignoreWhite = true; [/FONT]
[FONT=Courier New]xmlData.onLoad = loadXML; [/FONT]
[FONT=Courier New]xmlData.load(“header-messages.xml”);[/FONT]