Depth Sorting
Use this code to sort objects in 3d space.
function sortDepthOfField(clipArray) {
clipArray.sort(clipYSort);
for (var i = 0; i<clipArray.length; i++) {
clipArray[i].swapDepths(i);
}
}
sortOnY = function(a,b){
if(a._y > b._y){
return 1;
}else if(a._y < b._y){
return -1;
}else{
return 0;
}
}
theClips = [bird1, bird2, bird3, bird4, bird5, bird6];
this.onEnterFrame = function() {
sortDepthOfField(theClips);
};