且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AS3 - 排序嵌套数组的数组

更新时间:2023-08-20 14:36:28

既然你可以访问相同的方式数组索引作为属性(阵列[2] 是同数组[2] ),可以使用的 sortOn

Since you can access an array index in the same way as a property (array[2] is the same as array["2"]) you can use sortOn.

parentArray.sortOn("2", Array.NUMERIC);

您也可以使用其他的指标作为第二或第三排序字段如果不想平等项目的未predictable订单。

You can also use the other indices as second or third sort fields if don't want an unpredictable order for equal entries.

parentArray.sortOn(["2","1","0"], Array.NUMERIC);