Hello there!
I’ve struggled another problem, this time it’s about a class instance that keeps working*(EventListeners still going)* even when I’ve used removeChild and null’d the instance.
Here are my classes I use:
private var frame_splash:Splash;
private var frame_gameStart:GameStart;
private var frame_gameOver:GameOver;
private var frame_levelSelect:LevelSelect;
This is how I display them (Just showing the splash_screen):
public function show_splash():void {
removeInstances();
frame_splash = new Splash(this);
addChild(frame_splash);
}
And the function removeInstances():
private function removeInstances():void {
if (frame_splash) {
removeChild(frame_splash);
frame_splash = null;
}
if (frame_gameStart) {
removeChild(frame_gameStart);
frame_gameStart = null;
}
if (frame_gameOver) {
removeChild(frame_gameOver);
frame_gameOver = null;
}
if (frame_levelSelect) {
removeChild(frame_levelSelect);
frame_levelSelect = null;
}
}
As far as I understand, removeChild will only remove the child on the stage (the visible stuff), and the by setting the instance to null, will only remove the access from the instance, becuase when I look at the output I can see the game still tracing stuff about the game *(that’s not being displayed becuase of removeChild)
*
What would be the best way to remove/stop/hide the EventListeners, visible childs etc.?
Thanks in advance,
Tompa