Ricardo,
Thanks for the great code. I have modified it slightly so it will call a cleanup function when you change scenes, just like it calls new when you start scenes.
Change changeScene as follows:
[lua]------------------------------------------------------------------------
– CHANGE SCENE
function director:changeScene(nextScene,
currentScene,
effect,
arg1,
arg2,
arg3)
– If is the same, don’t change
if lastScene then
if string.lower(lastScene) == string.lower(nextScene) then
return true
end
end
local showFx
– EFFECT: Move From Right
if effect == “moveFromRight” then
nextView.x = display.contentWidth
nextView.y = 0
loadScene (nextScene,currentScene)
– (make sure you change each loadScene like this![/lua]
Change loadScene as follows:
[lua]------------------------------------------------------------------------
– LOAD SCENE
local function loadScene ( nextScene, currentScene )
nextScreen = require(nextScene).new()
nextView:insert(nextScreen)
–print (“Current Scene” … tostring(currentScreen))
if currentScene ~= nil then
require(currentScene).cleanup()
end
end[/lua]
Add the following to your specific file like new():
[lua]function cleanup()
– Add any scene specific deletions not handled in this function
timer.cancel(mytimer)
end[/lua]
Hope this makes sense. I needed a way to stop timers I had running. 
Mike Chapman
[import]uid: 9827 topic_id: 2447 reply_id: 7486[/import]