Tengo una matriz 'cat', 'perro', 'budgie'array as3 eliminar por índice
y quiero quitar el elemento por índice.
Por el momento tengo
function removeit(myindex) {
animals[myindex] = animals.pop()
}
Tengo una matriz 'cat', 'perro', 'budgie'array as3 eliminar por índice
y quiero quitar el elemento por índice.
Por el momento tengo
function removeit(myindex) {
animals[myindex] = animals.pop()
}
¿Quieres empalme
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html#splice%28%29
Array.splice (punto de partida, quite la cuenta);
var newArray:Array = myArray.splice(2, 1); //this removes whatever is at index 2 and returns it in a new array.
Cambiar su función para
function removeit(myindex) {
animals.splice(myindex, 1);
}
Al utilizar Flash Player o AIR 19+ 19+, puede utilizar
myArray.removeAt(myIndex); // removes the element at the specified index, modifying the array without making a copy
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html#removeAt()
¿Quieres decir 'animales [miíndice ] = null'? ¿Qué quieres que sea el resultado final? –
si paso 'gato, quiero que sea,' perro ', periquito'. Si elimino el artículo que estoy pasando a la función – LeBlaireau
las personas estarán más inclinadas a ayudarlo en el futuro si marca las respuestas como correctas :) – francis