Removing EventListener for "touch" , can't get it work

I tried a lot and browsed similar topics on here. They helped insofar as i narrowed the problems down, but it still doesn’t work.

function onCardTouch(self, event)  
 -- lots of code  
end  
-- code  
  
function setUpTouchArea\_1()  
 touch\_area = display.newRect(0,0,\_W,180) -- touch\_area = display.newRect(0,0,480,350)  
 touch\_area.isVisible = false  
 touch\_area.isHitTestable = true  
 touch\_area:setReferencePoint(display.CenterReferencePoint)  
 touch\_area.x=\_W/2 ; touch\_area.y=\_H - touch\_area.height/2  
  
 touch\_area.touch = onCardTouch  
 touch\_area:addEventListener("touch", touch\_area)  
end  
  
-- stop the touch   
function t\_pause()  
 -- in the scope?  
 print("pausetest touch\_area", touch\_area)  
 gameClock.pause()  
  
 -- both methods do not work!  
-- touch\_area.isHitTestable = false   
 touch\_area:removeEventListener("touch", onCardTouch)   
end  

right now i check every touch with a an if statement and additional boolean variables. I need to remove it for memory issues as well. [import]uid: 98393 topic_id: 28476 reply_id: 328476[/import]

The removeEventListener must be the exact same parameters as the addEventListner. Since you are doing it using “self” instead of a straight up function listener, try it this way:

touch_area:removeEventListener(“touch”, touch_area) [import]uid: 19626 topic_id: 28476 reply_id: 114937[/import]

i tried it this way before
doesn’t work as well

maybe one can’t remove a EventListener with “self” and “event” ?

[import]uid: 98393 topic_id: 28476 reply_id: 115017[/import]

I’ve solved the problem.
I was creating the touch listeners 2 times during the game, hence I was only deleting one listener and the other was still available with no access via any variable. [import]uid: 98393 topic_id: 28476 reply_id: 117097[/import]