Event listener problem

1 local storyboard = require (“storyboard”)
2 local scene = storyboard.newScene()
3
4 function scene:createScene(event)
5

6 local screenGroup = self.view
7
8 background = display.newImageRect(“Images/blue.jpg”, display.contentWidth, display.contentHeight)
9 background.y = display.contentCenterY
10 background.x = display.contentCenterX
11 screenGroup:insert(background)
12
13 backgroundSand = display.newImageRect(“Images/bg_sand.jpg”, display.contentWidth,25)
14 backgroundSand.x = display.contentCenterX
15 backgroundSand.y = display.contentHeight-10
16 screenGroup:insert(backgroundSand)
17
18 end
19
20 function start(event)
21 if event.phase == “began” then
22    storyboard.gotoScene(“game”, “fade”, 400)
23    end
23  end
25
26function scene:enterScene(event)
27
28  storyboard.purgeScene(“game”)
29  background:addEventListener(“touch”, start)
30

31 end
32
33 function scene:exitScene(event)
34
35
36  background:removeEventListener(“touch”, start)
37
38 end
39
40 function scene:destroyScene(event)
41
42 end
43
44 scene:addEventListener(“createScene”, scene)
45 scene:addEventListener(“enterScene”, scene)
46 scene:addEventListener(“exitScene”, scene)
47 scene:addEventListener(“destroyScene”, scene)
48
49 return scene

Hello and welcome to the community!

First of all, read: “Ask a Better Question, Get a Better Answer” at https://forums.coronalabs.com/topic/55780-ask-a-better-question-get-a-better-answer/

Second, you’ll probably want to use composer, which is the current scene management library for Corona. I’m not sure where you dug up storyboard, but if my memory serves me correct, it was replaced like 5 years ago or so already.

 

What is the problem?

You have to tell us.  

  1. What you did.

  2. What you saw.

  3. What you expected to see.

  4. Why you think #2 is wrong.

  5. (hopefully) what you did to debug the issue.

Hello and welcome to the community!

First of all, read: “Ask a Better Question, Get a Better Answer” at https://forums.coronalabs.com/topic/55780-ask-a-better-question-get-a-better-answer/

Second, you’ll probably want to use composer, which is the current scene management library for Corona. I’m not sure where you dug up storyboard, but if my memory serves me correct, it was replaced like 5 years ago or so already.

 

What is the problem?

You have to tell us.  

  1. What you did.

  2. What you saw.

  3. What you expected to see.

  4. Why you think #2 is wrong.

  5. (hopefully) what you did to debug the issue.