Touch event listener

I want to remove touch listener from a single object and want to remove listener from gameloop but the problem is, if i remove touch listener from one object, touch event listener also gets removed from the other objects which includes button also, below are the sample codes. Please try to solve the problem …
Thanks

local obj = {}
local function objListener()
end

for i=1,6 do
  obj[i] = display.newImageRect( “obj.png”)
            obj[i]:addEventListener( “touch”, objListener )
            sceneGroup:insert( obj[i] )
end

obj[1]: removeEventListener(“touch”, objListener)

  1. Please use code blocks in the future (<> symbol opens dialog to post code in when posting a blog entry).  No biggee this time, just a request.

  2.  Try this instead:

    local function onTouch( self, event ) – Single function used over and over print( "phase == ", event.phase ) – Just do do something for this example return true end local obj = {} for i=1,6 do – Pass group as first argument to auto-insert into that group – Use temporary local variable for ease of typing local tmp = display.newImageRect( sceneGroup, “obj.png”) – insert the reference in tmp into your table obj[i] = tmp – Point the .touch field to our common onTouch function tmp.touch = onTouch – Start listening for touch (since function is pointed to by ‘touch’ field, don’t need – to pass a function as second argument to addEventListener tmp:addEventListener( “touch” ) end – Later do this to remove a listener: obj[1]:removeEventListener( “touch” )

  1. Please use code blocks in the future (<> symbol opens dialog to post code in when posting a blog entry).  No biggee this time, just a request.

  2.  Try this instead:

    local function onTouch( self, event ) – Single function used over and over print( "phase == ", event.phase ) – Just do do something for this example return true end local obj = {} for i=1,6 do – Pass group as first argument to auto-insert into that group – Use temporary local variable for ease of typing local tmp = display.newImageRect( sceneGroup, “obj.png”) – insert the reference in tmp into your table obj[i] = tmp – Point the .touch field to our common onTouch function tmp.touch = onTouch – Start listening for touch (since function is pointed to by ‘touch’ field, don’t need – to pass a function as second argument to addEventListener tmp:addEventListener( “touch” ) end – Later do this to remove a listener: obj[1]:removeEventListener( “touch” )