Merge 2 arraycollection - Flex 3
How I actually merge both together?
one开发者_运维问答 arraycollection would contain value of 0...30 with Object name "sxx" with another arraycollection retrieve from database.
HI!
Solution 1:
private function mergeArrays(a:ArrayCollection, b:ArrayCollection):ArrayCollection
{
for each(var item:Object in b)
{
a.addItem(item);
}
return a;
}
Solution 2:
var a:ArrayCollection = new ArrayCollection([1,2]);
var b:ArrayCollection = new ArrayCollection([3,4]);
a = new ArrayCollection(a.toArray().concat(b.toArray()));
Have fun! :P
var first:ArrayCollection = new ArrayCollection(['aa','aaa','aaaa']);
var second:ArrayCollection = new ArrayCollection(['bb','bb','bb']);
first.source = first.source.concat(second.source);
精彩评论