More efficient way to remove an element from an array in Actionscript 3
Posted
by Joshua
on Stack Overflow
See other posts from Stack Overflow
or by Joshua
Published on 2010-05-26T19:05:40Z
Indexed on
2010/05/26
20:41 UTC
Read the original article
Hit count: 237
I have an array of objects. Each object has a property called name. I want to efficiently remove an object with a particular name from the array. Is this the BEST way?
private function RemoveSpoke(Name:String):void {
var Temp:Array=new Array;
for each (var S:Object in Spokes) {
if (S.Name!=Name) {
Temp.push(S);
}
}
Spokes=Temp;
}
© Stack Overflow or respective owner