Ok another AS3 problem that also has to do with event listeners (specifically the key event listener) and the garbage collector..
Ok, so at this moment, I have the entire game (as in gameplay part of game) in one class (with many subclasses of course..). All the game is displayed through that game class etc etc.., not one entity is outside it.
So whenever the player clicks on "start game" it creates a new entity of game, when you lose, frame plays game entity is deleted (removed from display list and then set to null). But it's not actually removing the entity from memory. One of the movieclips inside it is playing constantly (I know this thanks to trace).
And this is all because of the key listeners. They key listeners are still referencing to the game entity, and therefore the gc isn't cleaning it up. As soon as I remove the key listeners it all works great.. but obviously I need key listeners otherwise you won't be able to move!
The problem is key listeners can only be on stage for some reason, so I have to either put them in the document as file, or on the timeline.. either way I have to reference to the game entity and that doesn't let the garbage collector do it's job..
So I am officially stumped and have no idea where to go now.. halp? :(
PS: I have removed all event listeners within the class and all subclasses, including the ENTER_FRAME and TIMER ones.. there's a bug where even if those are weak referenced they won't remove (flash players fault).. Source (not source code :p)