Question

Je place le MC dans un tableau et que vous souhaitez retirer plus tard d'un indice peut-être jusqu'à la fin.

//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);

La façon de supprimer le MC de la scène même avec la retirer de tableau?

Était-ce utile?

La solution

Voulez-vous dire que, pour les MovieClips dans le tableau que vous voulez vous supprimez également de supprimer ceux de la scène?

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top