title: Corona sdk enterframe event issue with director
body: <p>I am having problems with getting a scene to change based on event listeners and global variables. </p>
  
  <p>Basically the scene reiterates after certain selections have been made which increments the variable <code>finalcount</code>, as the level of choices needs to be limited. The scene should change when the counter reaches 4, which makes the <code>finalcountscene</code> variable equal to 1. This should then trigger the change of scene, instead <code>scenechangeworking</code> 5 times. So the function works but the scene will not change. Please help! The code can be found below. </p>
  
  <pre><code>local function scenechangecount (event)
      if gameState.finalcountscene == 1 then
          Runtime:removeEventListener( "enterFrame",  maincount )
          director:changeScene ("gamemenu")
          print("scene change working")
          Runtime:removeEventListener( "enterFrame",  scenechangecount)
  end
  end
  
  local function maincount (event)
      if gameState.finalcount == 4 then
          gameState.finalcountscene = 1
       print("working",gameState.finalcount, "scene count", gameState.finalcountscene)
       Runtime:removeEventListener( "enterFrame",  maincount)
  
      elseif gameState.finalcount == 3 then
         gameState.finalcount = gameState.finalcount +1
         print(gameState.finalcount)
         local message = display.newImage ("images/message.png")
         message.x = display.contentWidth/2 - display.contentWidth/6 
         message.y = display.contentHeight/2 - display.contentHeight/4 - display.contentHeight/18
         localGroup:insert(message)
         Runtime:removeEventListener( "enterFrame",  maincount )
  
      else
         gameState.finalcount = gameState.finalcount + 1
         print(gameState.finalcount)
         Runtime:removeEventListener( "enterFrame",  maincount )
  end
  end
  
  Runtime:addEventListener ("enterFrame", scenechangecount)
  Runtime:addEventListener ("enterFrame", maincount)
  </code></pre>