-
Sorting an XML List
This seems like it should be a simple fix, but I'm getting hung up someplace.
I've loaded up an xml and that was pretty easy, but for some reason I can't sort the data in the xml.
I then put the xml directly into the code so I could limit down the possibility of errors. It traces out nicely, just like the loaded xml, but this sorting command is prematurely aging me.
Code:
var xml:XML = <alist>
<student name="Darrin Fletcher" films="4" />
<student name="Tracie Fletcher" films="5" />
<student name="Chet Thomas" films="7" />
</alist>;
var sl:XMLList = xml.student;
var item:XML;
for each(item in sl) {
sort(item.attribute('films'));
trace('Name: ' + item.attribute('name'));
}
-
scouring the web like a madman, I've found a few solutions but none are simple. This seems like a simple function that the XMLList should have had incorporated directly into it.
Dumb.
If anyone has a simple solution, I'd love to hear it.