I'm curious.
I have a collection of various scenes a lot of which contain widgets etc that all have their own various event handlers (mostly touch events but a few enter frame ones as well).
If I remove a "scene" from the main stage so that it's no longer being considered for rendering, am I correct in thinking that any event handlers associated with it's children are also ignored? or are references to the touch and enter frame functions stored and processed separately?
WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
#MakeABetterGame! "Never give up, Never
NEVER give up!" -
Winston Churchill
Comments
MOUSE/TOUCH/KEY -> Dispatched to Sprite objects which are on the stage
If you remove a scene from the stage, it and its children still continue to receive ENTER_FRAME event until they are collected, but they don't receive MOUSE/TOUCH/KEY events anymore (until it's put back to the stage).
For this reason, I always add and remove event listeners for ENTER_FRAME and MOUSE/TOUCH inside ADDED_TO_STAGE/REMOVED_FROM_STAGE handlers.
Could you tell me if this still necessary?
best regards
Likes: Dale
Can I request this as a feature (or at least the global option to set it so it doesn't happen)
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
I only recommend adding and removing only ENTER_FRAME event inside ADDED_TO_STAGE/REMOVED_FROM_STAGE handlers. So that that sprite doesn't consume additional CPU when it doesn't on the stage.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
I'm not sure I understand, this is available :
Event.ADDED_TO_STAGE = “addedToStage”
@atilim
What would be the typical use for this new event?
(if I understand well, ENTER_STAGE_FRAME sounds good.)
Although I'm sure this info about which events happen and to which items will be useful to know
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill