/**
* 深度
*/
public function changeDepth(obj:DisplayObject):void
{
var index:int = this.getChildIndex(obj);
var num:int = this.numChildren;
var nextObj:DisplayObject = index < num - 1 ? this.getChildAt(index + 1):obj;
if (obj.y > nextObj.y)
{
while (index < num - 1)
{
if (obj.y > this.getChildAt(index + 1).y)
{
this.swapChildrenAt(index, index + 1);
index++;
} else {
break;
}
}
} else {
while (index > 0)
{
if (obj.y < this.getChildAt(index - 1).y)
{
this.swapChildrenAt(index, index - 1);
index--;
} else {
break;
}
}
}
}