Extracción de objeto múltiple de matriz
-
13-09-2019 - |
Pregunta
coloco la MC en una matriz y me gustaría sacarlo adelante de un índice tal vez hasta el final.
//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);
Es la manera de eliminar el MC desde la etapa misma con sacarlo de matriz?
Solución
¿Quiere decir que para los clips de película en la matriz se quita también desea eliminar los de la etapa?
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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow