0
votes

I can't figure this one out, i'm sorry - really an ActionScript noobie here. I've searched for the problem but the answers i keep finding don't solve my problems. Anyone know whats wrong?

public function KikkerOgen() 
        {
            addEventListener(MouseEvent.CLICK, isClicked);
            timer.addEventListener(TimerEvent.TIMER, Knipperen);
            timer.start();
            gotoAndStop(13);
        }

        function isClicked (event:MouseEvent):void 
        {
            removeChild(this);
        }
1
ArgumentError: Error #2025: Het opgegeven DisplayObject moet een onderliggend item van de aanroeper zijn. at flash.display::DisplayObjectContainer/removeChild() at KikkerOgen/isClicked()[/Users/Amanda/Documents/Hanze/Jaar 1/Periode 4/MTM3/Spel/KikkerOgen.as:34] Cannot display source code at this location. -- This is my error and the code it refers too is in my main post. - Eleonara
It was my fault, sorry, i didn't see it, look at the answer - SharpEdge

1 Answers

0
votes

Sorry your problem is in:

removeChild(this);

You are trying to remove the object from the object itself!!!

That's what you should do:

this.parent.removeChild(this);