the array contains a bunch of objects, where pairs of objects have a same value for _myId.... Now I want to depth sort the objects in pairs, that is, sort them by their y and keep the objects with same id together. But the function I wrote doesn't seem to be working....any ideas?
Code:private function depthSort():void { var tempArray:Array = gameObjects; tempArray.sortOn(["_myId","y"], [Array.NUMERIC,Array.NUMERIC|Array.DESCENDING]); var i:uint = tempArray.length; while (i--) { trace(tempArray[i].y + " : " + tempArray[i]._myId+" -> "+i); if (_world.getChildIndex(tempArray[i]) != i) { _world.setChildIndex(tempArray[i],i); } } }




.
Reply With Quote