I have tried everything but nothing seems to make the eventListener to stop to work even when page changes.
My project uses Director (resumed code below):
module(..., package.seeall)
function new()
local numPages = 23
local menuGroup = display.newGroup()
local curPage = 23
local shakeMe23
local act\_action\_930
local drawScreen = function()
local onpageDownTouch = function(event)
if event.phase=="ended" then
local myClosure\_switch = function()
Runtime:removeEventListener("accelerometer", shakeMe23)
director:changeScene( "page\_19", "moveFromRight" )
end
timerStash.newTimer\_003 = timer.performWithDelay(300, myClosure\_switch, 1)
end
end
pageDown = ui.newButton{
defaultSrc=imgDir.."p23\_pagedown.png",
defaultX = 39,
defaultY = 48,
overSrc=imgDir.."p23\_pagedown.png",
overX = 39,
overY = 48,
onRelease=onpageDownTouch,
id="pageDownButton"
}
pageDown.x = 29; pageDown.y = 39; pageDown.alpha = 1; pageDown.oldAlpha = 1
menuGroup:insert(pageDown)
menuGroup.pageDown = pageDown
--SHAKE
function shakeMe23 (e)
if(e.isShake == true) then
act\_action\_930()
end
end
Runtime:addEventListener("accelerometer", shakeMe23)
--ACTIONS functions
function act\_action\_930 (event)
director:changeScene( "page\_"..curPage)
end
Issue is, even when I change pages, the “accelerometer” event keeps calling “shakeMe23” function.
Any ideas? [import]uid: 4883 topic_id: 19900 reply_id: 319900[/import]