splice random child from an array
I have an array of movieclip randomly placed at the bottom of the stage.
When the movieclips move past top of the stage I want to remove them.
But since they're positioned randomly, i don't know how to index and splice them.
function onEnter2(evt:Event):void
{
for(var i:int =0; i<numTri2; i++)
{
var tri2:goodTriangle = triangles2;
tri2.y -= vy;
if(tri2.y<=0-tri2.height)
{
removeChild(tri2); //ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
triangles2.splice(i,1);
if(triangles2.length<=0)
{
removeEventListener(Event.ENTER_FRAME, onEnter2);
}
}
}
}
Any advice/help would be appreciated!