Hello all,
I have some questions about removing event listeners. I understand that before we change to a different scene using sceneManager, we should remove event listeners. I have many mini games in my game, and in each there many event listeners. When I used onExitBegin, it didn't run, and I got an error. Therefore, I'm actually removing the event listeners before I do sceneManager:changeScene(.....).
My questions are as below:
1- if I remove a child, will it remove the event listeners attached to it?
2- What if I have an event listener like this, how shall I remove it?
self:addEventListener("increase score", function()
self.score = self.score + 100
end)
Thank you.
Comments
1) Technically yes, event listeners will be removed, for more information check this thread:
http://www.giderosmobile.com/forum/discussion/3034/does-removing-a-sprite-remove-any-event-listeners-attached-to-it/p1
2) since you have to pass same event listener to remove it, I think that there is no way to manually remove this kind of listener
Likes: cloud_time