I've got the following code loading some xml, creating dynamic arrays and pushing the data into the array...
I pulled some pieces out because it seems like each push overwrites the previous entry and I'm not sure why it's not working?! I posted the xml and code (without the trace statements) below, and also attached the fla and xml files in a zip...if anyone has an idea what I've got wrong that would be GREAT!!!
and the xml:Code:var counties:XML = new XML(); counties.ignoreWhite = true; counties.onLoad = function(success) { xN = counties.firstChild.firstChild; do { currID = xN.attributes.ID; var countyID:Array = new Array(); _root["arr"+currID] = countyID; loadLocs(); xN = xN.nextSibling; } while (xN.firstChild != null); }; // Load the XML counties.load("locsName.xml"); loadLocs = function () { nextN = xN.firstChild.firstChild; var tmp:Object = new Object(); do { tmp.Name1 = nextN.childNodes[0].childNodes[0]; _root["arr"+currID].push(tmp); nextN = nextN.nextSibling; } while (nextN.firstChild != null); };
Thanks!!Code:<?xml version="1.0" encoding="iso-8859-1"?> <Counties> <County Name="Cook" ID="031" eRegion="1"> <Locs> <Loc> <Name1>Air Cycle Corporation</Name1> </Loc> <Loc> <Name1>Assistive Technology Exchange Network</Name1> </Loc> <Loc> <Name1>Chicago Coalition for Information Access Community</Name1> </Loc> </Locs> </County> <County Name="Crawford" ID="033" eRegion="8"> <Locs> <Loc> <Name1>Crawford test</Name1> </Loc> </Locs> </County> <County Name="DuPage" ID="043" eRegion="1"> <Locs> <Loc> <Name1>Com2 Computers and Technology</Name1> </Loc> <Loc> <Name1>Fortune Plastic and Metal, Inc.</Name1> </Loc> </Locs> </County> <Counties>




Reply With Quote