My problem is I Have an isometric grid, just based on the X,Y values:
Each time you click a button for instance road than this item is pushed to an array()
//
addChild(roadTiles);
gameAssets.push(roadTiles);
arrangeAssets();
//
My arrangeAssets method just checks the array “no point posting as it fails most of the time.gennerally some items update but not all.
So im hoping some one has a solution to check X,Y value then setChildIndex of Array.
I have looked, keep getting reffered to 3rd party as3 engines which im not interested in as i want to make my own and have better understanding.

or is this not possible as im only using an X,Y grid
arrangeAssets();{
var i:int = gameAssets.length;
while(i--){
if (getChildIndex(sortedItems[i]) != i) {
gameAssets.sortOn("y", Array.NUMERIC);
setChildIndex(gameAssets[i], i);
}
}
I only add the items on top of the grass grid into the array.
assuming that the left most point is
x: 0, y:0the tiles are covering each other going from a highxand lowyto a lowxand highyvalues.I would add a
weightvariable (call it what you like), and calculate it from(totalx - x) * ythis would have the top-most corner have a value of 0, and the bottom most have the highest value. every row (diagonal really) would be the same.
Then sort on the
weightand you have a list of items in the relative z stack.this doesn’t really address the setchildIndex, because you can’t have two items there. a hack would be to remove all and add them back in the order. (you could have a temp child, that you add as children to, that way you don’t have to remove the children as it is done automatically)
I found this image that shows the
weightas_yfrom http://www.kirupa.com/developer/isometric/depth_sorting.htmthe _y is the same because
(totalx - x) * yvalues horizontally are the same