I’m trying to learn how to be more efficient in my XML programming. I hope you can help me in my goal. I followed the XML tutorial on this site which helped. Thanks! Can you please help me with my next challenge? I would greatly appreciate it.
In my fla I’m pulling in data from an XML file. I have six buttons that pull information from different nodes in the XML file. On each button I have the following code (plus a few node changes):
on (release) {
function loadXML(loaded) {
if (loaded) {
_root.sname = this.firstChild.childNodes[6].childNodes[0].firstChild/*.nodeValue*/;
_root.rep = this.firstChild.childNodes[6].childNodes[1].firstChild/*.nodeValue*/;
_root.email = this.firstChild.childNodes[6].childNodes[2].firstChild/*.nodeValue*/;
_root.phone = this.firstChild.childNodes[6].childNodes[3].firstChild/*.nodeValue*/;
sname_txt.text = _root.sname;
rep_txt.text = _root.rep;
email_txt.text = _root.email;
phone_txt.text = _root.phone;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("reps2.xml");
}
Is there a more efficient way that you suggest?
My fla is here: http://www.sethtaylor.com/fla/sethXML.zip
Secondly, how in the world can I make the email address a link to send an email like "mailto:name@domain.com" ? Any tips on this will be splendid.
-Seth