Having problems removing an event listener. The code below works fine and removes the listener as soon as it is created.
function otherTouch( event )
print( "otherTouch: event(" .. event.phase .. ") ("..event.x..","..event.y..")" .. tostring(event.id) )
end
Runtime:addEventListener( "touch", otherTouch )
Runtime:removeEventListener( "touch", otherTouch )
but if I try and call this from a function it does not remove the listener. I do not suspect this has anything to do with it, but I am using Director to change screens.
This does not work:
[code]
local function btnRewindT ( event )
if event.phase == “release” then
print(“btnRewind stopping Listener”)
Runtime:removeEventListener(“touch”, otherTouch )
end
end
function otherTouch( event )
print( “otherTouch: event(” … event.phase … “) (”…event.x…","…event.y…")" … tostring(event.id) )
end
Runtime:addEventListener( “touch”, otherTouch )
[/code] [import]uid: 52906 topic_id: 9439 reply_id: 309439[/import]