The only way to sort the order in which you can access the properties is by hand. Here is the function I created for you to do just that:
function getSortedPairs(object:Object):Array { var sorted:Array = []; for(var i:String in object) { sorted.push({ key: i, value: object[i] }); } sorted.sortOn("key"); return sorted; }
Trial:
var test:Object = { a: 1, b: 2, c: 3, d: 4, e: 5 }; var sorted:Array = getSortedPairs(test); for each(var i:Object in sorted) { trace(i.key, i.value); }
source share