runtime error lua:151: attempt to call field 'unloadMe' (a nil value)

I’m getting this runtime error when clicking a button that changes scene.

  
Copyright (C) 2009-2010 A n s c a , I n c .  
 Version: 2.0.0  
 Build: 2011.484  
The file sandbox for this project is located at the following folder:  
 (/Users/Lewis/Library/Application Support/Corona Simulator/gameProject-F0D0D3E2DD1984A889BF3BAA557935FA)  
Runtime error  
 /Users/Lewis/Desktop/gameProject/director.lua:151: attempt to call field 'unloadMe' (a nil value)  
stack traceback:  
 [C]: in function 'unloadMe'  
 /Users/Lewis/Desktop/gameProject/director.lua:151: in function '\_listener'  
 ?: in function <?:441>  
 ?: in function <?:214>  

Any ideas?

The scenes code looks like this.

[code]
module(…, package.seeall)

local assetPath = “assets/”

function new()

local localGroup = display.newGroup()

bgImage = display.newImageRect(assetPath … “optionscreen.png”, 480, 320 )
bgImage.x = 240; bgImage.y = 160

localGroup:insert( bgImage )

– PLAY NOW BUTTON
local onBackTouch = function( event )
if event.phase == “release” then
director:changeScene( “mainmenu” )
end
end

local playNowBtn = ui.newButton{
defaultSrc = assetPath … “back.png”,
defaultX = 135,
defaultY = 38,
overSrc = assetPath … “backrollover.png”,
overX = 135,
overY = 38,
onEvent = onBackTouch,
id = “PlayNowButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}

playNowBtn.x = 390; playNowBtn.y = 300
localGroup:insert( playNowBtn )

return localGroup
end

[/code] [import]uid: 68741 topic_id: 11736 reply_id: 311736[/import]

you’re using the ghost’s VS monsters director so you need to put a unloadME function in your code

[code]
function new()

local localGroup = display.newGroup()

unloadME = function()
– use this to desaloc some timers, objects that dont are implemented in group and some listeners

end
return localGroup
end [import]uid: 23063 topic_id: 11736 reply_id: 42730[/import]

Thanks alot mate. [import]uid: 68741 topic_id: 11736 reply_id: 42740[/import]