All of this assumes you use a number value of 1 or 2 as your posted xml suggests.
Here is a quick example that will at least show you how to dig out the nodes depending on what that number value is. In this I send all users with a value of "1" to one textfield and all with a value of "2" to the other textfield.
http://actionscript.hobby-site.com/e...s/freebie.html
It uses a flash movie with two textfields. One with an instance name of "txt1" and one with an instance name of "txt2". This puppy only needs one frame so post this in the actions for frame 1:
Code:
Group1 = new Array();
Group2 = new Array();
my_xml = new XML();
my_xml.load("./freebie.xml");
my_xml.ignoreWhite = true;
my_xml.onLoad = function(Success){
if (Success){
dissect();
}else{
txt1.text= "xml error.";
}
};
txt1.text="";
txt2.text="";
function dissect() {
i=0;
for (p=0; p<my_xml.firstChild.childNodes.length; p++) {
if(my_xml.firstChild.childNodes[p].childNodes[0].childNodes[0].nodeValue=="1"){
Group1.push(my_xml.firstChild.childNodes[i].childNodes[0].childNodes[0].nodeValue+"\n");
Group1.push(my_xml.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue+"\n");
Group1.push(my_xml.firstChild.childNodes[i].childNodes[2].childNodes[0].nodeValue+"\n");
i++;
txt1.text = Group1;
}else{
Group2.push(my_xml.firstChild.childNodes[i].childNodes[0].childNodes[0].nodeValue+"\n");
Group2.push(my_xml.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue+"\n");
Group2.push(my_xml.firstChild.childNodes[i].childNodes[2].childNodes[0].nodeValue+"\n");
i++;
txt2.text = Group2;
}
}
}
}
stop();
The freebie.xml file I used is just your original with me adding new ones from the backend that automatically show just like you requested:
Code:
<?xml version="1.0"?>
<cbs>
<employee>
<number>1</number>
<name>Shi Chuan</name>
<comment>intern</comment>
</employee>
<employee>
<number>1</number>
<name>Shang</name>
<comment>flasher</comment>
</employee>
<employee>
<number>2</number>
<name>Jakson</name>
<comment>rapist</comment>
</employee>
<employee>
<number>2</number>
<name>Charles</name>
<comment>director</comment>
</employee>
<employee>
<number>1</number>
<name>Chris</name>
<comment>XMLFreak</comment>
</employee>
<employee>
<number>2</number>
<name>Filipe</name>
<comment>Chef</comment>
</employee>
<employee>
<number>2</number>
<name>Pierre</name>
<comment>Bellhop</comment>
</employee>
</cbs>
This help?