ExpatTech is currently short-staffed due to increased corporate on-site work, and our office will often be closed. Please call +36705578849 to arrange an appointment time!

ExpatTech Techblog

Peter Todd 2010.09.27. 14:22

Flash Cookbook - Appendix - Sort array indices

Yes. This is about array sorting. So there is the problem, that we want to sort an array, but want to know more about the indices. For this reason there is an option for Array.sort() function, which specifies the return value of sort():


See the code below:

var array:Array = ["a", "c", "b"];
var sort:Array = array.sort(Array.RETURNINDEXEDARRAY);
trace(array, sort);

//a,c,b 0,2,1

It didn't sort the array, but returned an array with the sorted indices.