アレイから複数のオブジェクトを除去すること
-
13-09-2019 - |
質問
私は、配列内のMCを配置し、多分最後までインデックスから後でそれを削除したいと思います。
//Removeing MC from stage, from an index till the end
LISTmc.removeChild(listArray[clickedIndex+1]);
//Removing MC starting from an index till the end
listArray.splice(clickedIndex+1);
配列からそれを削除すると同じステージからMCを削除する方法ですか?
解決
あなたはあなたを削除し、アレイ内のムービークリップのためにも、ステージからそれらを削除することを?
を意味しますfor (var i:int = clickedIndex+1; i < listArray.length;i++)
{
//if this is on timeline leave as is otherwise you need to reference stage
removeChild(listArray[i]);
//if the movieclips are in various movieclips then you can do:
// var parent:DisplayObject = (listArray[i]).parent;
// parent.removeChild(listArray[i]);
}
listArray = listArray.slice(0,clickedIndex);//returns a new array from start index to end index
所属していません StackOverflow