So I have a main menu and a rules page. When I go to the rules page from my main menu page, the main menu and all items on it disappears as it should (only images, no text on main menu). However, when I go from my rules page, and click the close button (which calls the composer.gotoScene(“menu”…)) the text block remains. I have tried display.remove(), i have tried, composer.removeScene(), and I have tried, object:removeSelf() but I can’t for the life of me get the text to become removed.
Here is the gist of the code I am currently working with
local composer = require( "composer" ) local scene = composer.newScene() local rulesString= [[These are all the rules... blah blah]] local function gotoMenu() composer.gotoScene("menu", {time=800, effect= "crossFade"}) end function scene:create( event ) local sceneGroup = self.view local background = display.newImageRect( sceneGroup, "imgs/menuBG.png", (display.contentHeight\*2), (display.contentWidth\*2) ) background.x = display.contentCenterX background.y = display.contentCenterY local title = display.newImageRect( sceneGroup, "imgs/rulesTitle.png", 200, 75 ) title.x = display.contentCenterX title.y = display.contentCenterY/8 local closeButton = display.newImageRect( sceneGroup, "imgs/closeButton.png", 50, 50 ) closeButton.x = display.contentWidth -30 closeButton.y = -5 local rulesText = display.newText(rulesString, display.contentCenterX, (display.contentCenterY/8) + 50, display.contentWidth, 0, native.systemFont, 16) rulesText:setFillColor(0,0,0) rulesText.anchorY = 0 closeButton:addEventListener( "tap", gotoMenu ) end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then elseif phase == "did" then -- Called when the scene is now off screen composer.removeScene( "rules" ) audio.stop( 1 ) end end