Like Ben said.

 

I assume your posted code is not complete, since you are not building
your "item" arrayCollection anywhere.  Build that first, in a nested
loop, then do addAItem on the outer AC, passing the nes item ac as the
arg.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Friday, March 09, 2007 8:40 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Dynamically sized array collection

 

What problem are you having?

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "RadicalByte" <[EMAIL PROTECTED]> wrote:
>
> Hi All,
> 
> I'm hitting my head against a brick wall trying to work this out, but
> to no avail.
> 
> I would like to have an ArrayCollection which contains a variable
> number of ArrayCollections.
> 
> My code looks like..
> 
> [CODE]
> 
> var arrayCollection:ArrayCollection=new ArrayCollection();
> var numberOfItems:int=10;
> 
> for(var x=1;x<numberOfItems;x++)
> {
> arrayCollection.addItem(new ArrayCollection());
> }
> 
> [/CODE]
> 
> arrayCollection[0] will contain an array of strings
> arrayCollection[x] will contain an array of numbers
> 
> Structure wise it's like a spreadsheet, where the first column
> contains a title and the other columns numbers.
> 
> This collection will be mapped to a DataGrid and an BarChart - with
> the x-axis mapped to the array-of-strings and each series mapped to
> the numbers (this'll be dynamic, too).
> 
> My aim with the collection is to use it to hold SUM values from a
> tree-structured XML transmission. The XML transmission has a fixed
> debth but the number of properties may different. In my example
> below, I have "Hours" and "Cost" to SUM but in other XML transmissions
> I'll have "Hours", "Cost", "Profit", etc etc.
> 
> [XML]
> 
> <Weeks>
> <Week id="0" name="2007-01">
> <Tarif Name="A" Hours="100" Cost="50.00"/>
> <Tarif Name="B" Hours="100" Cost="50.00"/>
> <Tarif Name="C" Hours="100" Cost="50.00"/>
> </Week>
> <Week id="1" name="2007-02">
> <Tarif Name="A" Hours="100" Cost="50.00"/>
> <Tarif Name="C" Hours="100" Cost="50.00"/>
> </Week>
> </Weeks>
> 
> [/XML]
> 
> So, can anyone explain to me what I'm doing wrong?
> 
> Cheers,
> Ryan
>

 

Reply via email to