A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Array push not working??

Threaded View

  1. #1
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929

    Array push not working??

    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!!!


    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);
    };
    and the xml:

    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>
    Thanks!!
    Last edited by flashpipe1; 09-10-2007 at 01:37 PM.
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center