storyboard - multiple scene enterScene/existScene occuring - what's wrong with this code?

Have spent several hours trying to work out a Storyboard issue here. I’ve pruned a sample project down that replicates it.

Issue:

* After going from scene 1, to scene 2, then back to scene 1, and then toggling through scenes a few times I get the following:
* When entering a scene the logging shows multiple enterScene/exitScene are being triggered
* It seems as through perhaps multiple background touch listeners are being registered, however I’m trying to remove these in the exitScene functions
* I’m on the trial version: 2011.704 (2011.12.8)

Output

-- Click on background to go back to screen\_example1  
  
storyboard.gotoScene( screen\_example1)  
screen\_example1: enterScene  
  
storyboard.gotoScene( screen\_example1)  
screen\_example1: exitScene  
screen\_example1: enterScene  
  
storyboard.gotoScene( screen\_example1)  
screen\_example1: exitScene  
screen\_example1: enterScene  
  
storyboard.gotoScene( screen\_example1)  
screen\_example1: exitScene  
screen\_example1: enterScene  
  
.  
.  
.  
etc  

Code: Three files: main and the two scene files:

main.lua

display.setStatusBar( display.HiddenStatusBar )  
local storyboard = require "storyboard"  
storyboard.gotoScene( "screen\_example1" )  

screen_example1.lua

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
local function onScreenTouch( event )  
 if event.phase == "began" then  
 print("")  
 storyboard.gotoScene( "scene\_towerView")   
 end  
end  
function scene:createScene( event )  
 print ("screen\_example1 - createScene")  
 local image = display.newImage( "bg.jpg" )  
 scene.view:insert( image )  
end  
  
function scene:enterScene( event )  
 print ("screen\_example1: enterScene")  
 scene.view:addEventListener( "touch", onScreenTouch )  
end  
  
function scene:exitScene( event )  
 print ("screen\_example1: exitScene")  
 scene.view:removeEventListener("touch", onScreenTouch)  
end  
  
-- Scene Listeners  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
return scene  

scene_towerView.lua

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
local function onScreenTouch( event )  
 if event.phase == "began" then  
 print("")  
 print("storyboard.gotoScene( screen\_example1)")  
 storyboard.gotoScene( "screen\_example1")  
 end  
end  
  
-- Scene Handlers  
  
function scene:createScene( event )  
 print ("TowerScene - createScene")  
  
 -- -- Background Image  
 local image = display.newImage( "bg2.jpg" )  
 scene.view:insert( image )  
end  
  
function scene:enterScene( event )  
 print ("TowerScene - enterScene")  
 scene.view:addEventListener( "touch", onScreenTouch )  
end  
  
-- Scene Listeners  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

[import]uid: 140210 topic_id: 25980 reply_id: 325980[/import]

PS. Would this issue be because I’m on the trial version? Is the trial version much earlier than the current stable version? Any on the latest stable version get the same error I get?

I was going to follow the mooted concept that you could pay for your subscription when you are ready to submit, however if the trial version is way behind in terms of getting hides then I’ll Ned to get it now.

[import]uid: 140210 topic_id: 25980 reply_id: 105141[/import]