Create a temporary array, add data there using push() and then assign in to fields property.
tmpArray:Array = new Array(); tmpArray.push(sfSortField); tmpArray.push(sfLevel); aSort.fields = tmpArray; Cheers, Alex -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of iko_knyphausen Sent: Wednesday, February 28, 2007 11:04 PM To: [email protected] Subject: [flexcoders] Custom Collection Sorting Challenge Hi all, more questions on custom collection sorting... I have a XMLListCollection dataprovider, which I am sorting using a sort object. The sorting works as expected, when I use the following syntax to define the array of SortFields: aSort.fields = [sfSortField, sfLevel]; However, I would like to assemble the fields array dynamically, depending on column position, or what have you, so my first thought was to use the array.push() method to add the individual SortFields, but this fails without an exception being thrown... i = aSort.fields.push(sfSortField); i = aSort.fields.push(sfLevel); Any ideas? Thanks

