Greetings
I’ll try & explain as briefly as i can.
at the baselevel of my project, I am returning a XMLList
which looks like this…
<continent id="europe">
<location id="balen" activity="3"/>
<location id="overpelt" activity="18"/>
<location id="budel" activity="13"/>
<location id="london" activity="5"/>
<location id="zurich" activity="7"/>
<location id="essen" activity="13"/>
<location id="auby" activity="9"/>
</continent>
the returned name for this is _LocationList;
Originally I’ve used this object as a tester in order to get my other code working, as I was waiting on the developer’s xml from the database.
EUROPE:Object = [
{name:balen,ACT:Math.random()*2},
{name:overpelt,ACT:Math.random()*20},
{name:budel,ACT:Math.random()*20},
{name:londen,ACT:Math.random()*20},
{name:zurich,ACT:Math.random()*20},
{name:essen,ACT:Math.random()*20},
{name:auby,ACT:Math.random()*20}
];
I am using a for loop based on above’s XMLList in order to get the xml to an object.
But I wonder how I can re-reacte the exact Object as in EUROPE.
the next code, succesfully adds -only- the last item of the for loop to the object.
I can clearly trace out it’s auby in my other function that needs this object.
I am positive to be overlooking something silly here. but I just can’t seem to resolve this on my own. Many thanks for the light !
var EUROPE:Object = []
function parseLOCATIONDATA(_LocationList):Object
{
var NN = _LocationList.location
trace ("parsing in europe = " + NN.length()); // 7 is correct
for (var P:uint = 0;P<NN.length();P++)
{
trace (" name = " + NN[P].@id + " act " + NN[P].@activity);
//traces out each item...
EUROPE = {name: NN[P].@id , ACT: NN[P].@activity};
trace ("EUROPE = " + EUROPE.name);
//only adds the last item to the object aka :auby ...
}
return EUROPE;
}
I tried to use push() but it gives errors.
Thank you for saving me a few hours of “euuhm’s & curses”