I have an object in ActionScript3 code, which I need to sort.
I iterate through the object and print out each value:
for (var i:String in columnData) {
However I need the data I am iterating to be sorted alphabetically. Any suggestions on how to do this?
You can only sort Array/Lists, not fields in an object.
If you want a sorted order, you first need to iterate thru the object and push the values in an array/list and then sort it.
[Edit]: OK, so I assumed you just needed the data. No, flex doesn’t provide a hashmap (like a TreeMap ala Java). What you could do is to store the name value pairs as objects in an array. Array provides a
SortOn()method to let you sort on a specific field.