Hi guys just want to know if it is safe to use composer.removeScene() as it is or I need to code some if statements. Tha case is that I need to remove 7 scenes in some specific scene an I make a local variable assignment for the scene name before removing it and the scene do not remove. But, if I call composer.removeScene() without the assignment the scenes remove. I’m using the composer.removeScene() in scene:show “did” phase.
-- show() function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) elseif ( phase == "did" ) then composer.removeScene ("scenes/one") composer.removeScene ("scenes/two") composer.removeScene ("scenes/three") composer.removeScene ("scenes/four") composer.removeScene ("scenes/five") composer.removeScene ("scenes/six") composer.removeScene ("scenes/seven") end end ------- or elseif ( phase == "did" ) then local removeScene1 = composer.getScene("scenes/one") composer.removeScene (removeScene1) -- same to scene seven end
I would like to know if I need to verify if the scene is “nil” before calling composer.removeScene()?
Thanks
DoDi