AS3 – Getting the order of MovieClips in the stage
12 years ago
Here is yet another small code snippet which allows you to get the order of MovieClips that are positioned on the stage.
var boxes:Array = [box1, box2, box3, box4]; //put the MovieClips into an array
boxes.sortOn("x", Array.NUMERIC); //sort array on the x positions from smallest to largest
trace(boxes); // traces the order of the boxes according to their x positions
Source for the demo above: DownloadAuthor: Ben Foster Date: June 6, 2010