In my game, people can go back to the menu when they want. So when I go back to the menu, I make null all of the classes I instantiated. I then make them new again:
**private var myClass:MYCLASS; // this happens once
someFunction () { // called when game begins and every time i go back to the menu and restart
if (myClass != null) {
myClass = null;
myClass = new MYCLASS();
}
}**
Do I have to remove all of the listeners in the class I am making null?
Now when I go back to the menu, and do this, it is like the class is still instantiated and now there are two! When I shoot my gun, I hear it twice, and it traces out twice when I begin the game again. If I go back to menu for the second time, and restart game, when I shoot my gun it traces out three times from that same class that I made null.
I don’t understand what is happening. It is like it is not truly getting rid of the class. Is it because I possibly still have something connected to that class? When I make it null though, I trace it and it reads “null”.
Any help would be greatly appreciated. This is a tuffy :jailbreak
ty