I have a problem about mc depth. I prepared around 200 enemy mc objects. These enemy objects moves on game area with their random path. The problem is depth order. When an enemy pass near by another enemy display order goes wrong.
I have 2D area. I try to give 3D effect visually depending on their Y coordinate value. If Y coordinate of an enemy is higher than other this enemy should show at top. If Y koordinate is lower than another this enemy should show on back. When all enemy objects moving their depth should calculate dynamically. I defined an array. I m sorting all enemy objects depending their Y value first. Then I set their depth value after this calculation. But so many objects with random move requares huge processor work. How can I do this simply?

I m searching another way of display ordering. With using AS2 solution was very simple because it is possible to set object's depth higher how much I want. It is not necessary to sorting. Depth value can be more than number of objects. Unfortunatelly AS3 doesn't allow this. Now I m thinking. If I create 1000 Empty movieclips AS3 allows me set depth value up to 5000. If my enemy objects moving between 0 and 5000 (Y component of its coordinate). This solution causing another problem. Main stage movement goes slow when I drag it.

My another poor idea is calculation a constant depending on (numberOfObjects / maxYvalue) each object's depth can set depending on this ratio (may multiplying its Y value and this ratio).

I think setChildIndex is good but I like need freedom of swapDepths() in AS3.