Код AS3:
arraySort.sort(mySort);
private function mySort(objA:Object, objB:Object) {
if (objA.y<objB.y)
{
return 1;
}
else if (objA.y>objB.y)
{
return -1;
}
else
{
return 0;
}
}
for ( var newDepth:uint=0; newDepth<arraySort.length; newDepth++)
setChildIndex(arraySort[newDepth], newDepth);