I’m Writing a Lyric app for a band, it contains many scenes, but they keep mixing up, meaning in album scene when i click an album it goes there but there when i click a song name, it also triggers album scenes tap listner, meaning it brings up the album page on top of the songs lyric which is weird because all my scene are full screen
i tryed reamoving taplistner,scenes,images after going to new scene but none works
a-*.lua & m-*.lua files are pretty muck same so i just send one of them
-----------------------main.lua \_W = display.viewableContentWidth; \_H = display.viewableContentHeight; local composer = require( "composer" ) composer.gotoScene("welcome"); ---------------------welcome.lua local composer = require( "composer" ) local scene = composer.newScene() local back; local next; function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local background = display.newRect(0,0,\_W,\_H); background:setFillColor(255,255,255); back = display.newImageRect("images/back.png",\_W,\_H); back:setReferencePoint(display.CenterReferencePoint); back.x = \_W \* 0.5; back.y = \_H \* 0.5; local function tapListener( e ) -- Code executed when the button is tapped composer.gotoScene("albums", { effect = "fade", time = 250 }); return true end next = display.newImageRect("images/next.png",\_W\*3/4,\_H/4); next:setReferencePoint(display.CenterReferencePoint); next.x = \_W \* 0.55; next.y = \_H \* 3/4; next:addEventListener( "tap", tapListener ); end -- 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 -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view composer.removeScene("welcome"); end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene ------------------------------------------albums.lua local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local background = display.newRect(0,0,\_W,\_H); background:setFillColor(255,255,255); local back; local fallen; local dream; local anywhere; local evanescence; local notfor; local opendoor; local origin; local sound; local whispers; back = display.newImageRect("images/e.png",\_W,\_H); back:setReferencePoint(display.CenterReferencePoint); back.x = \_W \* 0.5; back.y = \_H \* 0.5; local function tapListener( es ) if(es.target == fallen) then composer.gotoScene("a-fallen", { effect = "fade", time = 250 }); elseif(es.target == dream) then composer.gotoScene("a-dream", { effect = "fade", time = 250 }); elseif(es.target == anywhere) then composer.gotoScene("a-anywhere", { effect = "fade", time = 250 }); elseif(es.target == notfor) then composer.gotoScene("a-notfor", { effect = "fade", time = 250 }); elseif(es.target == evanescence) then composer.gotoScene("a-evanescence", { effect = "fade", time = 250 }); elseif(es.target == whispers) then composer.gotoScene("a-whispers", { effect = "fade", time = 250 }); elseif(es.target == sound) then composer.gotoScene("a-sound", { effect = "fade", time = 250 }); elseif(es.target == origin) then composer.gotoScene("a-origin", { effect = "fade", time = 250 }); elseif(es.target == opendoor) then composer.gotoScene("a-opendoor", { effect = "fade", time = 250 }); end return true end fallen = display.newImageRect("images/fallen.jpg",\_W\*0.26,\_W\*0.26); fallen:setReferencePoint(display.CenterReferencePoint); fallen.x = \_W \* 0.25; fallen.y = \_H \* 0.4; fallen:addEventListener( "tap", tapListener ); dream = display.newImageRect("images/dream.jpg",\_W\*0.26,\_W\*0.26); dream:setReferencePoint(display.CenterReferencePoint); dream.x = \_W \* 0.5; dream.y = \_H \* 0.4; dream:addEventListener( "tap", tapListener ); anywhere = display.newImageRect("images/anywhere.jpg",\_W\*0.26,\_W\*0.26); anywhere:setReferencePoint(display.CenterReferencePoint); anywhere.x = \_W \* 0.75; anywhere.y = \_H \* 0.4; anywhere:addEventListener( "tap", tapListener ); notfor = display.newImageRect("images/notfor.jpg",\_W\*0.26,\_W\*0.26); notfor:setReferencePoint(display.CenterReferencePoint); notfor.x = \_W \* 0.25; notfor.y = \_H \* 0.6; notfor:addEventListener( "tap", tapListener ); opendoor = display.newImageRect("images/opendoor.jpg",\_W\*0.26,\_W\*0.26); opendoor:setReferencePoint(display.CenterReferencePoint); opendoor.x = \_W \* 0.5; opendoor.y = \_H \* 0.6; opendoor:addEventListener( "tap", tapListener ); origin = display.newImageRect("images/origin.jpg",\_W\*0.26,\_W\*0.26); origin:setReferencePoint(display.CenterReferencePoint); origin.x = \_W \* 0.75; origin.y = \_H \* 0.6; origin:addEventListener( "tap", tapListener ); sound = display.newImageRect("images/sound.jpg",\_W\*0.26,\_W\*0.26); sound:setReferencePoint(display.CenterReferencePoint); sound.x = \_W \* 0.25; sound.y = \_H \* 0.8; sound:addEventListener( "tap", tapListener ); whispers = display.newImageRect("images/whispers.jpg",\_W\*0.26,\_W\*0.26); whispers:setReferencePoint(display.CenterReferencePoint); whispers.x = \_W \* 0.5; whispers.y = \_H \* 0.8; whispers:addEventListener( "tap", tapListener ); evanescence = display.newImageRect("images/evanescence.jpg",\_W\*0.26,\_W\*0.26); evanescence:setReferencePoint(display.CenterReferencePoint); evanescence.x = \_W \* 0.75; evanescence.y = \_H \* 0.8; evanescence:addEventListener( "tap", tapListener ); end -- 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 -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view Runtime:removeEventListener( "tap", tapListener ); composer.removeScene("albums"); fallen:removeSelf(); fallen = nil; dream:removeSelf(); dream = nil; anywhere:removeSelf(); anywhere = nil; notfor:removeSelf(); notfor = nil; evanescence:removeSelf(); evanescence = nil; whispers:removeSelf(); whispers = nil; sound:removeSelf(); sound = nil; origin:removeSelf(); origin = nil; opendoor:removeSelf(); opendoor = nil; end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene ----------------------------------------------------a-fallen.lua local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local background = display.newRect(0,0,\_W,\_H); background:setFillColor(255,255,255); local back; local fallen; local dream; local anywhere; local evanescence; local notfor; local opendoor; local origin; local sound; local whispers; local aa; local bb; back = display.newImageRect("images/fallen.png",\_W,\_H); back:setReferencePoint(display.CenterReferencePoint); back.x = \_W \* 0.5; back.y = \_H \* 0.5; local function tapListener( ea ) if(ea.target == going) then composer.removeScene("a-fallen"); composer.gotoScene("m-going", { effect = "fade", time = 250 }); elseif(ea.target == bring) then composer.removeScene("a-fallen"); composer.gotoScene("m-bring", { effect = "fade", time = 250 }); elseif(ea.target == anywhere) then composer.removeScene("a-fallen"); composer.gotoScene("m-everybody", { effect = "fade", time = 250 }); elseif(ea.target == notfor) then composer.removeScene("a-fallen"); composer.gotoScene("m-immortal", { effect = "fade", time = 250 }); elseif(ea.target == evanescence) then composer.removeScene("a-fallen"); composer.gotoScene("m-haunted", { effect = "fade", time = 250 }); elseif(ea.target == whispers) then composer.removeScene("a-fallen"); composer.gotoScene("m-tourniquet", { effect = "fade", time = 250 }); elseif(ea.target == sound) then composer.removeScene("a-fallen"); composer.gotoScene("m-imaginary", { effect = "fade", time = 250 }); elseif(ea.target == origin) then composer.removeScene("a-fallen"); composer.gotoScene("m-takingover", { effect = "fade", time = 250 }); elseif(ea.target == opendoor) then composer.removeScene("a-fallen"); composer.gotoScene("m-hello", { effect = "fade", time = 250 }); elseif(ea.target == aa) then composer.removeScene("a-fallen"); composer.gotoScene("m-breath", { effect = "fade", time = 250 }); elseif(ea.target == bb) then composer.removeScene("a-fallen"); composer.gotoScene("m-whisper", { effect = "fade", time = 250 }); return true end end going = display.newText("Going Under",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); going:setFillColor(255,255,255); going:setReferencePoint(display.CenterReferencePoint); going.x = \_W \* 0.5; going.y = \_H \* 0.30; going:addEventListener( "tap", tapListener ); bring = display.newText("Bring Me To Life",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); bring:setFillColor(255,255,255); bring:setReferencePoint(display.CenterReferencePoint); bring.x = \_W \* 0.5; bring.y = \_H \* 0.37; bring:addEventListener( "tap", tapListener ); anywhere = display.newText("Everybody's Fool",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); anywhere:setFillColor(255,255,255); anywhere:setReferencePoint(display.CenterReferencePoint); anywhere.x = \_W \* 0.5; anywhere.y = \_H \* 0.44; anywhere:addEventListener( "tap", tapListener ); notfor = display.newText("My Immortal",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); notfor:setFillColor(255,255,255); notfor:setReferencePoint(display.CenterReferencePoint); notfor.x = \_W \* 0.5; notfor.y = \_H \* 0.51; notfor:addEventListener( "tap", tapListener ); opendoor = display.newText("Haunted",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); opendoor:setFillColor(255,255,255); opendoor:setReferencePoint(display.CenterReferencePoint); opendoor.x = \_W \* 0.5; opendoor.y = \_H \* 0.58; opendoor:addEventListener( "tap", tapListener ); origin = display.newText("Tourniquet",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); origin:setFillColor(255,255,255); origin:setReferencePoint(display.CenterReferencePoint); origin.x = \_W \* 0.5; origin.y = \_H \* 0.65; origin:addEventListener( "tap", tapListener ); sound = display.newText("Imaginary",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); sound:setFillColor(255,255,255); sound:setReferencePoint(display.CenterReferencePoint); sound.x = \_W \* 0.5; sound.y = \_H \* 0.72; sound:addEventListener( "tap", tapListener ); whispers = display.newText("Taking Over Me",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); whispers:setFillColor(255,255,255); whispers:setReferencePoint(display.CenterReferencePoint); whispers.x = \_W \* 0.5; whispers.y = \_H \* 0.79; whispers:addEventListener( "tap", tapListener ); evanescence = display.newText("Hello",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); evanescence:setFillColor(255,255,255); evanescence:setReferencePoint(display.CenterReferencePoint); evanescence.x = \_W \* 0.5; evanescence.y = \_H \* 0.86; evanescence:addEventListener( "tap", tapListener ); aa = display.newText("My Last Breath",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); aa:setFillColor(255,255,255); aa:setReferencePoint(display.CenterReferencePoint); aa.x = \_W \* 0.5; aa.y = \_H \* 0.93; aa:addEventListener( "tap", tapListener ); bb = display.newText("Whisper",\_W\*0.5,\_H\*0.5, "pristina.ttf", 28); bb:setFillColor(255,255,255); bb:setReferencePoint(display.CenterReferencePoint); bb.x = \_W \* 0.5; bb.y = \_H ; bb:addEventListener( "tap", tapListener ); end -- 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 -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view Runtime:removeEventListener( "tap", tapListener ); end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene -------------------------------------------------m-going.lua local composer = require( "composer" ) local scene = composer.newScene() local back; local fallen; function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local background = display.newRect(0,0,\_W,\_H); background:setFillColor(255,255,255); back = display.newImageRect("images/e.png",\_W,\_H); back:setReferencePoint(display.CenterReferencePoint); back.x = \_W \* 0.5; back.y = \_H \* 0.5; fallen = display.newImageRect("images/going.png",\_W,\_W\*4.16); fallen:setReferencePoint(display.TopReferencePoint); fallen.x = \_W \* 0.5; fallen.y = \_H ; local widget = require( "widget" ) local scrollView = widget.newScrollView({ width = \_W, height = \_W\*4.16, horizontalScrollDisabled = true, verticalScrollDisabled = false }) scrollView:insert(fallen); end -- 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 -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view composer.removeScene("m-going"); end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene