0
我有一个关于away3D的小问题。我有一些尺寸完全相同的立方体放在同一个地方。当我点击多维数据集堆栈时,我想注册一个点击最后添加的多维数据集。而不是这样做,点击被注册在我首先添加的立方体上。如何获得away3D的顶级儿童?
我找到了一种方法来改变容器中的立方体位置,并试图把元素放在最后(代码如下)并开始childrenArray,但似乎没有任何工作。我有点儿被卡在这里,所以如果有人知道如何在点击堆栈时获得顶层元素,我会很高兴听到。
//We get the targetCube's childIndex.
for(var i:uint = 0; i < _3DContent.children.length; i++)
{
if(_targetCube == _3DContent.children[i])
break;
}
//Now we rearrange the array if the targetCube is different from
//the last cube in our list of children.
if(i != _3DContent.children.length-1)
{
//We reposition the children.
for(var j:uint = i; j < _3DContent.children.length-1; j++)
_3DContent.children[j] = _3DContent.children[j+1];
//Lastly, we push the child.
_3DContent.children[_3DContent.children.length-1] = _targetCube;
}