2009-11-03 7 views
0

나는 배열에 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를 제거하는 방법은 어레이에서 제거하는 것입니까?

답변

1

제거한 배열의 무비 클립에 대해 스테이지에서 무비 클립을 제거하고 싶습니까?

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