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.

Answers


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);

Need Your Help

Page won't scroll on mobile, text bunched at the top of page

html css

I've recently made my first website whilst learning HTML/CSS/Js/PhP over a couple of months.