Frage

Ich stelle die MC in einem Array und möchte es später von einem Index auf entfernen vielleicht bis zum Ende.

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

Ist der Weg, um die MC von der Bühne gleiche mit dem Entfernen von ihm aus dem Array entfernt werden?

War es hilfreich?

Lösung

Meinen Sie, dass für die Movieclips in der Matrix auch Sie entfernen Sie diejenigen, von der Bühne entfernen?

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top