A
A
Andrey Begin2018-07-14 17:45:40
ActionScript
Andrey Begin, 2018-07-14 17:45:40

How to close current scene and display another one in AS3?

In general, I wrote the code for the mini-game.
I need to make it so that after the game ends, the scene with the game closes and the scene with the main menu opens.
This is the part of the code where the game ends, in class N

var GoMenu:Main = new Main(); 
addChild(GoMenu); //Добавляю сцену с меню
          
GoMenu.closePlay(); //Вызываю функцию с закрытием сцены игры из Main класса

This is, respectively, the closePlay function itself in the Main class
public function closePlay():void
{
  GoPlay2 = new SceneGame();
  removeChild(GoPlay2); //Пытаюсь закрыть сцену с игрой
}

But alas, with this code, the launch just crashes,
screen
5b4a0c4f93a19900686512.png

Like I haven't tried before...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question