This content has been marked as final. Show 7 replies
Use Flash’s sortOn( ) function. This will sort the whole array by a particular attribute in the element. This is very good if you have an associative array to sort out.
> This is very good if you have an associative array
> to sort out.
Associative arrays cannot be sorted ... maybe you are thinking of something
else and have used the wrong term :)
That is absolutely it. Thank you so much for your help.
“Associative arrays cannot be sorted … maybe you are thinking of something
else and have used the wrong term :)”
Ahh…yes. I meant an index array that has objects inside the elements. Thanks for pointing that out for me! :)
> Ahh?yes. I meant an index array that has objects inside the elements.
> for pointing that out for me! :)
Thought that might have been it .. don't want to confuse the novices any
more than they already are ;):)
I too experienced the same problem with Flash 8 Professional while trying to sort an object array.
I solved the problem by <somearrayname>.sortOn("label", Array.NUMERIC | Array.DESCENDING);
the array needs to be an indexed array if the code needs to work. Beware of the odd diamention arrays as they will create OBOB errors (search wikipedia for off by one bug for more details). If you are using POP and PUSH to populate the array then take extra care about the index values of the array as this values may be of inverse order.