accessing event.parent in Hide overlay

Is it bad practice to call a parent function in scene:hide( event ) for an overlay?

I called a parent function before and it would crash on some devices(the parent would be nil)…BUT i think I called it in “DID HIDE” not sure I can’t remember. But it seems to me if you called it in “WILL HIDE” – the overlay has not been destroyed yet.I remove all my Scenes in “DID HIDE.”

Just wondering if its bad practice.

Thanks

Jeff

Yeah, I looked at my previous backup code and  I called the parent function in “did Hide” it would crash on some devices with the parent would be"nil"

-- "scene:hide()" function scene:hide( event )    local sceneGroup = self.view    local phase = event.phase    local parent = event.parent        if ( phase == "will" ) then       -- Called when the scene is on screen (but is about to go off screen).       -- Insert code here to "pause" the scene.       -- Example: stop timers, stop animation, stop audio, etc.    elseif ( phase == "did" ) then       -- Called immediately after scene goes off screen.       parent:stopBloodEmitter( )       composer.removeScene("startgame\_overlay")    end end

Would I be SAFE to call the parent function in “WILL HIDE” it seems logical to me that event.parent would not be “nil” because it hasn’t left the screen yet.

Accessing the parent isn’t a bad thing.  But you probably don’t want to try and remove a scene until it’s off screen.

Rob

Yeah, I looked at my previous backup code and  I called the parent function in “did Hide” it would crash on some devices with the parent would be"nil"

-- "scene:hide()" function scene:hide( event )    local sceneGroup = self.view    local phase = event.phase    local parent = event.parent        if ( phase == "will" ) then       -- Called when the scene is on screen (but is about to go off screen).       -- Insert code here to "pause" the scene.       -- Example: stop timers, stop animation, stop audio, etc.    elseif ( phase == "did" ) then       -- Called immediately after scene goes off screen.       parent:stopBloodEmitter( )       composer.removeScene("startgame\_overlay")    end end

Would I be SAFE to call the parent function in “WILL HIDE” it seems logical to me that event.parent would not be “nil” because it hasn’t left the screen yet.

Accessing the parent isn’t a bad thing.  But you probably don’t want to try and remove a scene until it’s off screen.

Rob