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
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.
North America
Europe, Middle East and Africa
Asia Pacific