AS3 Unload Problem
I'm creating a game over screen and there is a retry button on it, when that button is clicked, the game over screen remove itself and jump to the main screen so player could restart it. When the retry button is clicked for the first time, it works fine, the game over screen is gone. But when it is clicked for the second time, the game over screen is here again, it just keeps coming back after the first retry. It seems the unload works for the first time only. Any help is greatly appreciated!
public class GameOverMenu extends BaseMenu {
public function GameOverMenu(stageRef: Stage = null) {
this.stageRef = stageRef;
btnRetry.addEventListener(MouseEvent.MOUSE_DOWN, returnMainMenu, false, 0, true);
}
private function returnMainMenu(e: MouseEvent😞 void {
unload(new MainMenu(stageRef));
}
}
