Hi,
Can I call a function when building an array in Flex 3?
public function gridBuilder(myArray:Array):void {
var i:uint;
for (i=0; i<myArray.length; i++){
dGArray = [
{Name: myArray[i].name, Type: 'A:', Score: myArray[i].score, Rank: myArray[i].rank, Grade:(myFunction(myArray[i].rank, myArray[i].max_rank))},
{Name: myArray[i].name, Type: 'B:', Score: myArray[i].score, Rank: myArray[i].rank }
]
}
dgAC = new ArrayCollection(dGArray);
}
MyArray is the result of a remote call to the database. I then prepare the array to be used in a dataGrid. I also want to call a function that provides a grade. Unfortunately, my function appears to be called only once. Is it possible to call a function when you're building an array? Please see the "Grade:" bit. What's the problem? How do I solve this problem?
Thank you!
-Laxmidi