Hello Alex,
Thanks for taking the time.
-
I’m calling the nextButtonCounter() in the ‘create’ phase.
-
The nextButtonCounter() is a “tap” event, and the event is being passed to it as created in top of my code.
-
True, thought I get the display one by one working, and then add the remove part after.
Please help!
isplay.setStatusBar( display.HiddenStatusBar ) local composer = require( "composer" ) local widget = require( "widget" ) -- Load scene with same root filename as this file local scene = composer.newScene( sceneName ) --------------------------------------------------------------------------------- local background local nextButton local backButton local exitButton local nextCount = 0 -- For handling the event function of all buttons after they are pressed local function handleButtonEvent( event ) if ( "ended" == event.phase ) then print( "Button was pressed and released" ) end end ---- Instructions Table local instructions = { [1] = "stepOne.png", [2] = "StepTwo.png", [3] = "StepThree.png", [4] = "StepFour.png" } local function instructionsfn() --- COUNTING THE NUMBER OF TIMES THE 'NEXT' Button is Tapped local function nextButtonCounter() nextCount = 0 if nextButton.event.phase == "ended" then nextCount = nextCount + 1 for i = nextCount, #instructions do local instructions = display.newImageRect( "images/projectOne/oneSitePage/"..instructions[nextCount], 63.55, 10.66) instructions.x = display.contentWidth \* 0.17 instructions.y = display.contentHeight \* 0.80 end end end end --------------------------------------------------------------------------------- function scene:create( event ) local sceneGroup = self.view background = display.newImageRect( sceneGroup, "images/projectOne/oneSitePage/bg.png", 570, 380 ) background.x = display.contentWidth / 2 background.y = display.contentHeight / 2 nextButton = display.newImageRect( sceneGroup, "images/projectOne/oneSitePage/next.png", 41.36, 23.18 ) nextButton.x = display.contentWidth \* 0.374 nextButton.y = display.contentHeight \* 0.78 backButton = display.newImageRect( sceneGroup, "images/projectOne/oneSitePage/back.png", 41.36, 23.18 ) backButton.x = display.contentWidth \* 0.374 backButton.y = display.contentHeight \* 0.865 exitButton = display.newImageRect( sceneGroup, "images/projectOne/oneSitePage/exit.png", 41.36, 23.18 ) exitButton.x = display.contentWidth \* 0.374 exitButton.y = display.contentHeight \* 0.95 nextButton:addEventListener("tap", instructionsfn) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then elseif phase == "did" then end end function scene:destroy( event ) local sceneGroup = self.view end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene