I am quite new when it comes to actionscript. I want to have a next button that will control the text that is pulled in dynamically from an XML file. Here is an example of what I have so far:
XML Code:
<directory>
<contact>
<name>Tom</name>
<address>123 River Rd</address>
<phone>555-1234</phone>
</contact>
<contact>
<name>Dave</name>
<text>456 Lake Ln</text>
<describe>555-4321</describe>
</contact>
<contact>
<name>Steve</name>
<text>789 Stream St</text>
<describe>555-5678</describe>
</contact>
</directory>
Actionscript Code:
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.describe = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
describe_txt.text = _root.describe;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
trace("file not loaded!");
}
}
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = loadXML;
my_xml.load("data/phonebook.xml");
So when I open the swf it is showing the first contacts information (tom,123 River Rd, 555-1234). I would like to program next and back buttons to change the information displayed (show the next contact information or the previous contact information). For the life of me I can't figure out the actionscript to make this happen. I would appreciate any help I can get. Thanks in advance.