Hi, this is a question regarding Senocular’s Approach to Depth Sorting tip of the day, but anyone is very welcome to answer it!
I am trying to use his code:
var sortedItems:Array = new Array(mc1, mc2, mc3);
function arrange():void {
sortedItems.sortOn(“y”, Array.NUMERIC);
var i:int = sortedItems.length;
while(i–){
if (getChildAt(i) != sortedItems*) {
setChildIndex(sortedItems*, i);
}
}
}
To automatically sort the depths of my objects depending on their y position. To my delight, this worked. But I have a problem. For some reason the objects I apply it to stop being animated (which defeats the point).
E.G. I have two objects, one stationary (stat_mc), one moving (move_mc). When move_mc moves up over stat_mc it should go behind it when move_mc’s y position is less than stat_mc’s. However, this code seems to stop move_mc from moving!
I can’t understand what is in this code which is causing this.
Thank you so much for any help.