Assuming the XMLListCollection created from the myData XML object looks like this:
public var col:XMLListCollection = new XMLListCollection(myData.children()); Then you would sort on the category name like so: private function applyMySort():void { var s:Sort = new Sort(); s.fields = [new SortField("@name")]; col.sort = s; col.refresh(); } As for your second question, we don't support e4x expressions in the sort field. To get that behavior you'll have to write your own compareFunction that compares on the values you desire. You'll find that the mx.utils.ObjectUtil class has all the comparators you'd need to do this. Cheers, deepa -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Oliver Lietz Sent: Monday, December 04, 2006 6:55 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] XMLList/XMLListCollection: sort on attributes Hello List, is there a way to sort a XMLList/XMLListCollection on their items attributes? What has to be done to sort the sample myData from "Using the XMLListCollection class" [1] on the category name? Or is it possible to sort when making an E4X query? tia, O. [1] http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/ww help.htm?context=LiveDocs_Parts&file=00000513.html#403970 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links