Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 05-14-2012, 02:02 AM   #1
Claunchster
Registered User
 
Join Date: May 2012
Posts: 5
Unhappy Pulling Specific Data from XML

I need to be able to use as2 to search through my XML file and populate dynamic text field with certain data. Here's and example of my xml:

//-------------------- AS2 --------------------
function loadXML(loaded) {

if (loaded && typerank == "1"){

_root.firstperiod = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.typerank= this.firstChild.childNodes[0].childNodes[6].firstChild.nodeValue;

ffscore1_1_txt.text=_root.typingtest;
ffname1_1_txt.text = _root.firstperiod;
}else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("firstperiod.xml");
//-------------------- End AS2 --------------------

When I use this my xml doesn't load.

My xml actually looks like this:

//-------------------- XML --------------------
<fp>
<name>Last, First</name>
<abyss>736</abyss>
<abyssrank>6</abyssrank>
<adventure>35498</adventure>
<adventurerank>12</adventurerank>
<typingtest>19</typingtest>
<typerank>12</typerank>
<abysslw>736</abysslw>
<adventurelw>35498</adventurelw>
<typingtestlw>19</typingtestlw>
</fp>
//-------------------- End XML --------------------

I'm already using this xml to extrapolate data out of in other areas of the site and it works great. Now I just want to use it more in a different location to look at the "*rank" labels and see if they == 1, 2 or 3 and then fill in dynamic fields with the name, and score data. So I want to search for the highest grade and fill in a dynamic text field, or maybe the second highest grade and pull that data, and the name of the person. How could I do this?

Thanks!
Claunchster is offline   Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:40 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.