1
votes

I have a warning about this:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() I don't what is wrong with the code.

public function Laser() {

}
1

1 Answers

1
votes

You add laser to the stage, so remove it also from the stage.

if(lasers[l].y < 0) 
{

    stage.removeChild(lasers[l]); // <- Here
    lasers[l] = null;
    lasers.splice(l, 1);
    trace("Remove laser from screen");

}