i need help on this one, my brain stopped working (:
how to synchronize 2 arrays? let’s say I have squares and circles with numbers, like (c1, c2, c3…) and (s2, s4, s3, s1…). I need to make new array that will sort one array based on other… they don’t have to have same number of items, if that’s the case only things that are in smaller array have to be sync.ed…
i’ve tried this:
for (var i:int = 0; i < first.length; i++) {
for (var j:int = 0; j < second.length; j++) {
if (first*.number != second[j].number) {
temp.push(second.shift());
second.push(temp.pop());
} else {
newArray.push(second[j]);
}
}
}
but i have a problem when number of items isn’t same in first and second array…
in my application im loading objects with xml properties. I made 2 arrays, one with display objects- items are added as they load, the other array (with xml properties of each object) is created in loop when i make loaders… So, i don’t know when my object will finish loading and I already have xml array. I have to synchronize them as my objects load, since I want to be able to access properties of even one loaded object…