Also, you could splice() or concat() the source arrays, then wrap the
result in ArrayCollection.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Scott Melby
Sent: Wednesday, August 27, 2008 12:08 PM
To: [email protected]
Subject: Re: [flexcoders] How do I enter 2 arrays into one
arraycollection

 

Brute force approach (not sure if it'll compile, but it'll get you
close):

var combinedArray:Array = new Array();

for each(var obj:Object in array1)
{
combinedArray.push(obj);
}

for each(obj in array2)
{
combinedArray.push(obj);
}

myArrayCollection.source = combinedArray;

hth
Scott

-- 
Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com <http://www.fastlanesw.com> 

tallen_eit wrote:
> Hello,
>
> I am trying to use 2 arrays I generate from a mySql database to 
> populate an AdvancedDataGrid. I need to be able to use the following 
> format but replace the static data with the two arrays I receive from 
> AMFPHP.
>
> (I pulled the following snippet from Peter Ent's blog (thank you
Peter!)
>
>
> [Bindable]
> private var companyData:ArrayCollection = new ArrayCollection(
> [ 
> {type:"department", title:"Engineering", children: new 
> ArrayCollection(
> [ 
> {type:"employee", name:"Erin M"},
> 
> {type:"employee", name:"Ann B"} ] ) },
> 
> ] );
>
>
> How could I place the following arrays in the statement above?
> Parent = myParentArray
> children = myChildrenArray
>
> Thank you,
>
> Terry Allen
>
>
>
>
> 

 

Reply via email to