http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=2
function sortChildrenByY(container:MovieClip):void {
var i:int;
var childList:Array = new Array();
i = container.numChildren;
while(i--){
childList[i] = container.getChildAt(i);
}
childList.sortOn("y", Array.NUMERIC);
i = container.numChildren;
while(i--){
if (childList[i] != container.getChildAt(i)){
container.setChildIndex(childList[i], i);
}
}
}
sortChildrenByY(this);
No comments:
Post a Comment