It looks like you're new here. If you want to get involved, click one of these buttons!
 moopf            
            
                Guru
moopf            
            
                Guru             
            | <pre> function Blah:init() function stageAdded(event) gamespace:addEventListener("game_paused", pauseGame) gamespace:addEventListener("game_resumed", resumeGame) end function stageRemoved(event) gamespace:removeEventListener("game_paused", pauseGame) gamespace:removeEventListener("game_resumed", resumeGame) end self:addEventListener(Event.ADDED_TO_STAGE, stageAdded) self:addEventListener(Event.REMOVED_FROM_STAGE, stageRemoved) end | 
Comments
I don't have much time to answer but there were a couple of suggestions that people made on that thread :
Broadcast messages for custom events : how to?.
That's the result I got : Broadcast messages - result
I hope you will find some things that will help you there.
I think there's a problem with my solution though as I'm getting periodic crashes caused by the event dispatcher dispatching an event to an object that's no longer a child. Going to debug that this morning to see what's going on. As I'm removing all children from the scene before destroying them, first place to check is that Event.REMOVED_FROM_STAGE is actually triggering 100% of the time.
Likes: Mells, moopf
I learned something new today.
For those who want to have a better understanding of the solution provided by atilim :
Weak Tables Tutorial - at lua-users.org
Likes: moopf
Likes: atilim