Search code examples
actionscript-3apache-flexflex4flex3flex4.5

is it possible to store few ArrayCollections inside a ArrayCollection or Array?


Actually my intension is to store dynamically generated ArrayCollections inside a ArrayCollection or Array or using any other method. Is this possible?


Solution

  • Got the Answer. Not much difficult same object storing method used.

    This is my example arrayCollection

    private var expenses:ArrayCollection = new ArrayCollection([
                {Label:"Taxes", Value:1001},
                {Label:"Rent", Value:1005},
                {Label:"Bills", Value:1008},
                {Label:"Car", Value:1009},
                {Label:"Gas", Value:1020},
                {Label:"Food", Value:1015},
                {Label:"Taxes1", Value:1080},
                {Label:"Rent1", Value:1200},
                {Label:"Bills1", Value:100} ,
                {Label:"Car1", Value:450},
                {Label:"Gas1", Value:100},
                {Label:"Food1", Value:1750},
                {Label:"Taxes2", Value:1275},
                {Label:"Rent2", Value:1650},
                {Label:"Bills2", Value:1220},
                {Label:"Car2", Value:1550},
                {Label:"Gas2", Value:900},
                {Label:"Food2", Value:850},
                {Label:"g", Value:900},
                {Label:"h", Value:850} 
            ]);
    

    this is how i store inside expenese ArrayCollection inside another ArrayCollection

    var arr:ArrayCollection=new ArrayCollection();
    
                    var obj:Object=new Object();
    
                    obj.value=expenses;
    
                    arr.addItem(obj);