I am having a ****ens of a time trying to find out how many items I have in each of my libraries. I can get the count of childNodes in the furniture which is 4, I can drill down and get the names of the libraries, Tables, Chairs, Sofas and Hutches. But I can’t figure out how to get the count of the items in the libraries.
What I want to have happen is when I click on the library value in the combo box the out put window would say for Table: 2 items, end_table and rd_table… etc… for each item clicked in the combo box.
But I can’t figure it out.
Please help.;(
Here is the XML:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<furniture>
<tables name="Tables">
<item title="End Table">end_table</item>
<item title="Round Table">rd_table</item>
</tables>
<chairs name="Chairs">
<item title="Recliner">chair</item>
</chairs>
<sofas name="Sofas">
<item title="Leather Sofa">sofa</item>
</sofas>
<hutches name="Hutches">
<item title="Double Hutch">hutch</item>
</hutches>
</furniture>
Here is the flash code
var myXML:XML = new XML();
myXML.ignoreWhite = true;
libraryList_ar = new Array();
libraryItems_ar = new Array();
//combo_list.dataProvider= ["Library", "Tables", "Chairs", "Sofas", "Hutches"];
combo_list.dataProvider = libraryList_ar;
myXML.onLoad = function(success) {
if (success) {
//trace(this);
//
var libraries = this.firstChild;
var libCount = libraries.childNodes.length;
trace(libCount);
var libItems = libraries.childNodes.childNodes.length;
trace(libItems);
for (var i = 0; i<libCount; i++) {
//libraryList_ar* = libraries.childNodes*.childNodes[0].firstChild.nodeValue;
libraryList_ar* = libraries.childNodes*.attributes.name;
}
}
};
myXML.load("myXML.xml");
//
combo_list.change = function(eventObj) {
//trace("Value changed to "+eventObj.target.value);
};
combo_list.addEventListener("change", combo_list);