Hi, I'm making a game in Action Script, and I need to change levels. The current method I'm using for this, is removing all children from the first level, and then replacing them with the new children from the next level. It loads the children from the next level, and even appears to remove the ones from the first level, but it doesn't. When I move my player arround(which I shouldn't even be able to do since the player should have been deleted too), I will bump into the walls that I placed, even though the only things visible is from the new level. Here is my code for changing levels.
function changeLevel(id)
{
trace(this.numChildren); //shows all my objects
while(this.numChildren)
this.removeChildAt(0);
trace(this.numChildren); //shows 0 children
addChild(new swfLoader().loadSWF("level\\" + id.toString() + ".swf")); //class i made for loading SWF files
trace(this.numChildren); //shows children of new level
}
If no one posts anything, then I'll upload a video showing the problem.