Copy link to clipboard
Copied
Hello,
Following Problem:
I want to remove a child from an Array. I removed all refrences, the child and set it =null. I also used weak references where i couldnt remove eventlistener. Anyways the Child is still in the Array.
for(var i = 0;i < fliesArray.length;i++){
removeChild(fliesArray[1]);
fliesArray[1] = null;
TweenMax.killTweensOf(fliesArray[0]);
removeChild(fliesArray[0]);
fliesArray[0] = null;
I have this in my "end game" function
also I thought the Arrays in AS3 dynamicly closes the gap if an Object is deletet.
Example: Object with index 25 is deletet, object with index 26 gets index 25, index 27 gets 26 etc. pp.
is that correct?
Thanks!
1 Correct answer
that array will not 'automatically update'. use:
for(var i = fliesArray.length-1;i>=0;i--){
TweenMax.killTweensOf(fliesArray[0]);
removeChild(fliesArray[1]);
fliesArray[0] = null;
fliesArray.splice(i,1);
}
Copy link to clipboard
Copied
that array will not 'automatically update'. use:
for(var i = fliesArray.length-1;i>=0;i--){
TweenMax.killTweensOf(fliesArray[0]);
removeChild(fliesArray[1]);
fliesArray[0] = null;
fliesArray.splice(i,1);
}
Copy link to clipboard
Copied
Thanks kglad, u're the best!
Copy link to clipboard
Copied
you're welcome.

