Вопрос

Я помещаю 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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top