Try this:

private function convert(columns:ArrayCollection,
data:ArrayCollection):ArrayCollection
{
     var returnAC:ArrayCollection = new ArrayCollection();
     for(var i:int = 0 ; i < data.length ; i += columns.length)
     {
         var currentRow:Object = new Object();
         for(var j:int = 0 ; j < columns.length ; j++)
         {
             currentRow[columns[j]] = data[i + j];
         }
         returnAC.addItem(currentRow);
     }
     return returnAC;
}



HTH




Steve


--- In [email protected], "Wally Kolcz" <wko...@...> wrote:
>
> I have a web service that send back my column names and data in 2
seperate collections. I would like to put them back together as one
arraycollection. I created a method that takes the total number of
record, the Arraycollection of  column names and the arraycollection of
data. I would like to get it back to where I can say
myData.getItemAt(0).ProjectName
>
> Here is what I have so far, but trying to create an object name
dynamically is causing an error. Any ideas? Thanks!
>
> public function convert(total:int, columns:ArrayCollection,
data:ArrayCollection):ArrayCollection {
>
>             var AC:ArrayCollection = new ArrayCollection();
>
>             //Loop over the total number of records
>             for (var r:int = 0; r < total; r++){
>                 //Create a new row for the ArrayCollection
>                 var row:Object = new Object();
>                 //Loop over the columns and data
>                 for (var i:int = 0; i< columns.length(); i++){
>                     row.column[r][i].toString()=data[r][i]; 
<----Error on the 'row.column...'
>                 }
>                 AC.addItem(row);
>
>             }
>
>             return AC;
>         }
>

Reply via email to