So, I essentially want to make http://www.spoono.com/flash/tutorials/tutorial.php?id=21 bring up the lastChild instead of the first. I’ve tried to modify the original code to this:
contacts.load("contacts.xml");
contacts.onLoad = function(success) {
if (success) {
name_txt = this.firstChild.lastChild.attributes.name;
email_txt = this.firstChild.lastChild.attributes.email;
web_txt = this.firstChild.lastChild.attributes.website;
_root.total = this.firstChild.childNodes.length;
_root.current = _root.entry + 1;
entryNum_txt = _root.current+" of "+ _root.total;
}
};
From:
contacts.load("contacts.xml");
contacts.onLoad = function(success) {
if (success) {
name_txt = this.firstChild.childNodes[_root.entry].attributes.name;
email_txt = this.firstChild.childNodes[_root.entry].attributes.email;
web_txt = this.firstChild.childNodes[_root.entry].attributes.website;
_root.total = this.firstChild.childNodes.length;
_root.current = _root.entry + 1;
entryNum_txt = _root.current+" of "+ _root.total;
}
};
But what happens is the buttons don’t work, so I can’t go through the siblings or anything. The reason I want to load the lastChild is because I’m going take Kirupa’s XML Guestbook and use that to write to the xml file that this one loads - that way I won’t have to go into the xml document itself and write in it. I’ve also tried to modify the xml guestbook to “insertBefore”, but for some reason it doesn’t work - and I think that loading the lastChild is a lot easier than messing with the guestbook as much. I’d appreciate any help! I know there’s a way - I’ve just been searching all over and trying different things, but I can’t find a solution. Maybe someone here will be able to help me! Thanks!