문제

나는 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를 무대에서 제거하는 방법은 배열에서 제거하는 것과 동일합니까?

도움이 되었습니까?

해결책

배열의 movieclips의 경우 무대에서 그것들을 제거하고 싶다는 것을 의미합니까?

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top