StackScreenNavigator shows only one screen at a time. There is not an already existing GameScreen
"below" your GamePausedScreen
. When you show GamePausedScreen
, GameScreen
is removed. Then, when you pop GamePausedScreen
, it creates a new GameScreen
to display.
However, it is possible to restore the original GameScreen
instance. You need to do something like this:
var gameScreen:GameScreen = new GameScreen();
var item_game:StackScreenNavigatorItem = new StackScreenNavigatorItem(gameScreen);
This will use the same instance of GameScreen
every time. It still removes that instance, but it will add the same instance back when you pop GamePausedScreen
.
Generally, I recommend that you should avoid passing a display object instead of a class to StackScreenNavigatorItem
, except in limited circumstances. You definitely shouldn't do it for every screen because you might use too much GPU memory. However, you might decide that it is fine for one screen, like GameScreen
. Up to you, of course. My recommendation is usually to let the navigator create a new instance every time, but use the navigator's ability to save and restore the screen's data. You'll need to look at the docs for how to do that, if you're interested.