actionscript-3 – AS3 Vector. Sort() does not use sorting options?

In AS3, array Sort () uses some good sorting options, such as:

> Array. Descending – sort arrays from large to small > array Returnindexedarray – returns an array of indexes so that you can track which items have been sorted where

Unfortunately, vector < T > Sort () does not support these functions. It only needs a comparefunction: function parameter, so you can write your own sorting logic

Is there any other way to quickly get the sorted index array of vectors?

Solution

View document: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html#sort ()

You can still use these options, but you must pass them as the first argument instead of the comparison function

myVector.sort(Array.DESCENDING|Array.RETURNINDEXEDARRAY);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>