|
-
[RESOLVED] Clearing the stage (in preparation for the next level)
Hey everyone,
Me again. I got the level I was working on to work correctly, but now a new problem has risen.
I'm trying to clear the stage of all objects on there, so that I can show the next part of the game (albeit in a new frame, or by adding new MCs onto the stage).
Basically, I have a loop checking to see whether or not the player has reached the end of the current level, as well as checking if the stage has been cleared yet:
Code:
else if((stop_all == true)&&(empty_stage == false)){
cleanup();
}
The 'else' is definitely needed. stop_all is set to true as soon as the player reaches the end of the level, empty_stage is initially set to false.
Code:
function cleanup():void{
for (var si=0; si<stage.numChildren; si++){
children.push(stage.getChildAt(si));
}
for (si=0; si<children.length; si++){
children[si].parent.removeChild(children[si]);
}
empty_stage = true;
gotoAndPlay("bonusgame");
//setEnd();
}
Code:
function setEnd():void{
endtext.x = 500;
endtext.y = 500;
endtext.text = ("Gefeliciteerd!!Je hebt een topsnelheid van ");
addChild(endtext);
trace(endtext.text); // This one works.
}
All of the needed variables are declared, but the object just won't show up (other objects won't either). However, I can still trace out endtext's text, x and y, alpha and other properties.
I've also tried a gotoAndPlay("nextPartOfGame") instead of the setEnd() function, but to no avail.
Again, any help would be much appreciated.
-Patrick
PS: .fla and .as files can be uploaded on request.
Last edited by senshi sentou; 01-08-2010 at 04:53 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|