Understanding Array::splice in ActionScript 3

numerical25 picture numerical25 · Jan 12, 2010 · Viewed 44.9k times · Source

I am trying to remove an object from an array, but for some reason it's not working. I am under the impression that a splice accepts 2 parameters: first, the position in the array to begin at. And for parameter 2, how many to delete from then on out.

I just want to delete one entry so I am doing this:

array.splice(i,0);

But it isn't working. Can someone tell me what I am doing wrong and enlighten me on how it is supposed to work.

Answer

Anon. picture Anon. · Jan 12, 2010

If you want to remove one element, you call splice(index, 1).