title: Moving to next scene in Corona/LUA
body: <p>I've been at this for a while now and nothing I try works. I'm trying to make it so when you press the <code>playButton</code>, the scene changes to scene2. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>local storyboard = require( "storyboard" )
  local scene = storyboard.newScene()
  
  ---------------------------------------------------------------------------------
  -- BEGINNING OF YOUR IMPLEMENTATION
  ---------------------------------------------------------------------------------
  
  local image, playButton, helpButton, text3, memTimer
  print("test")
  
  -- Touch event listener for background image
  local function onSceneTouch( self, event )
      if event.phase == "began" then
  
          storyboard.gotoScene( "scene2", "slideLeft", 800  )
  
          return true
          end
      end
  
  
  -- Called when the scene's view does not exist:
  function scene:createScene( event )
  
      local screenGroup = self.view
  
      image = display.newImage( screenGroup, "openingbackground.png" )
      image.x = _W * 0.5
      image.y = _H * 0.5
      screenGroup:insert( image )
  
      local playButton = display.newImage( "playbutton.png" )
      playButton.x = _H * 0.33
      playButton.y = _W * 0.90
      playButton.xScale = 0.5
      playButton.yScale = 0.5
      playButton.touch = onSceneTouch
      screenGroup:insert( playButton )
  
  
      local helpButton = display.newImage ("helpbutton.png")
      helpButton.x = _H * 0.33
      helpButton.y = _W * 1.1
      helpButton.xScale = 0.5
      helpButton.yScale = 0.5
      screenGroup:insert( helpButton )
  
      playButton:addEventListener("touch", playButton)
  
  
  end
  
  
  -- Called immediately after scene has moved onscreen:
  function scene:enterScene( event )
  
  
  end
  
  
  -- Called when scene is about to move offscreen:
  function scene:exitScene( event )
  
      print( "1: exitScene event" )
  
      -- remove touch listener for image
      image:removeEventListener( "touch", image )
  
      -- cancel timer
      timer.cancel( memTimer ); memTimer = nil;
  
      -- reset label text
      text2.text = "MemUsage: "
  end
  
  
  -- Called prior to the removal of scene's "view" (display group)
  function scene:destroyScene( event )
  
      print( "1: destroyScene event" )
  end
  
  ---------------------------------------------------------------------------------
  -- END OF YOUR IMPLEMENTATION
  ---------------------------------------------------------------------------------
  
  -- "createScene" event is dispatched if scene's view does not exist
  scene:addEventListener( "createScene", scene )
  
  -- "enterScene" event is dispatched whenever scene transition has finished
  scene:addEventListener( "enterScene", scene )
  
  -- "exitScene" event is dispatched before next scene's transition begins
  scene:addEventListener( "exitScene", scene )
  
  -- "destroyScene" event is dispatched before view is unloaded, which can be
  -- automatically unloaded in low memory situations, or explicitly via a call to
  -- storyboard.purgeScene() or storyboard.removeScene().
  scene:addEventListener( "destroyScene", scene )
  
  ---------------------------------------------------------------------------------
  
  return scene
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <p><code>Corona Runtime Error: ?:0? attempt to index a nil value stack traceback: ... Do you want to relaunch the project?</code></p>
  
  <p><img src="https://i.stack.imgur.com/Q82Au.png" alt="img"></p>
  
  <p>Anyone got any ideas?</p>