Skip navigation
AnimatedCircle
Currently Being Moderated

Error Help Please

Apr 15, 2012 11:10 AM

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

          at flash.display::DisplayObjectContainer/removeChild()

          at Application2_fla::MainTimeline/frame9()

          at flash.display::MovieClip/gotoAndStop()

          at Function/<anonymous>()

 

What does this mean please?

 

Frame 9 coding

 

flash.display.MovieClip

 

 

stop();

 

 

stage.removeChild(Characters1); //Remove Child Characters1 From Stage

stage.removeChild(Characters2); //Remove Child Characters2 From Stage

 

 

var playerScoreScreen = int(playerFinalScore.text); //Convert To Integer

var computerScoreScreen = int(computerFinalScore.text); //Convert To Integer

 

 

this.addEventListener(Event.ENTER_FRAME, overallWinner); //Add Enter Frame Event Listener

function overallWinner(event:Event):void

{

          //If playerFinalScore Is Equal To computerFinalScore Do The Following

          if (int(playerFinalScore.text) == int(computerFinalScore.text))

          {

                    announceWinner.text = "Draw"; //Display In The announceWinner Text Box That It's A Draw

                    trace("Draw"); //Trace That It's A Draw

          }

          //If playerFinalScore Is Greater Than computerFinalScore Do The Following

          if(int(playerFinalScore.text) > int(computerFinalScore.text))

          {

                    announceWinner.text = "Player Wins"; //Display In The announceWinner Text Box That The Player Wins

                    trace("Player Wins"); //Trace That The Player Wins

          }

          //Else Do The Following

          else

          {

                    announceWinner.text = "Computer Wins"; //Display In The announceWinner Text Box That The Computer Wins

                    trace("Computer Wins"); //Trace That The Computer Wins

          }

}

 

 

playAgain.addEventListener(MouseEvent.CLICK, retry);

function retry(event:MouseEvent)

{

          gotoAndStop(8);

}

 

 

//Adding An Event Listener To The Button playAgain

//Function retry Runs gotoAndStop(8); Which Is Go To And Stop At Frame 8 Allowing You To Play The Application Game Again

 

 

displayCredits.addEventListener(MouseEvent.CLICK, credits);

function credits(event:MouseEvent)

{

          gotoAndPlay(10);

}

 

 

//Adding An Event Listener To The Button creditsButton

//Function retry Runs gotoAndStop(10); Which Is Go To And Stop At Frame 10 Allowing You To View The Credits

 
Replies
  • Currently Being Moderated
    Apr 15, 2012 12:17 PM   in reply to AnimatedCircle

    It means you are trying to remove an object as if it is a child of another object, but it isn't.  If you happen to be trying to remove Characters1 and Characters2 and one of them doesn't exist, then that error will erupt.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 15, 2012 1:55 PM   in reply to AnimatedCircle

    Existing has nothing to do with the error, though if you try to remove them after they have already been removed that can cause the error as well.  To sort it out you find out what code is executing when that is trying to remove an object that is not a child.  The error will be valid, your finding why is your challenge.  To find the code you can put traces before each line to see when the error comes up. You need to learn how to make the most of using the trace command.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 15, 2012 4:43 PM   in reply to AnimatedCircle

    Your posting is about having an error.  I cannot give you code to fix your error because it involves more than just your code.  Spending hours and hours comes with the territory sort things out is part of the learning curve.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points