Can't remove EventListener

HI, i am trying to remove event listeners but can not get it work, this function is called each round of my game, but i need the event listeners to be removed from each of the 5 buttons once one has been pressed.

My buttons work and variables captured but when one button is pressed the others still work, please help

[code]
– FOOD SELECT

local selectFood = function()

local foodBtn1
if foodSelection1 == “Chilli” then
foodBtn1 = display.newImageRect(“images/chilli.png”, 35, 32.5)
foodBtn1.x = _W/2; foodBtn1.y = _H/4
foodBtn1.alpha = 0.23
else
foodBtn1 = display.newImageRect(“images/chilli.png”, 35, 32.5)
foodBtn1.x = _W/2; foodBtn1.y = _H/4
foodBtn1.alpha = 1
end

local foodBtn2
if foodSelection2 == “Donut” then
foodBtn2 = display.newImageRect(“images/donut-locked.png”, 35, 32.5)
foodBtn2.x = _W/2 + 40; foodBtn2.y = _H/4
foodBtn2.alpha = 0.23
else
foodBtn2 = display.newImageRect(“images/donut-locked.png”, 35, 32.5)
foodBtn2.x = _W/2 + 40; foodBtn2.y = _H/4
foodBtn2.alpha = 1
end

local foodBtn3 = display.newImageRect(“images/hotdog-locked.png”, 35, 32.5)
foodBtn3.x = _W/2 + 80; foodBtn3.y = _H/4
foodBtn3.alpha = 1

local foodBtn4 = display.newImageRect(“images/burger-locked.png”, 35, 32.5)
foodBtn4.x = _W/2 + 120; foodBtn4.y = _H/4

local foodBtn5 = display.newImageRect(“images/icecream-locked.png”, 35, 32.5)
foodBtn5.x = _W/2 + 160; foodBtn5.y = _H/4

local function chooseFood1 (e)
if e.phase==“ended” then
foodSelection1 = “Chilli”
foodxForce = 1
foodyForce = 3
transition.to( foodBtn1, { time=1000, alpha=0, onComplete=killListener } )
print(“food:” … foodSelection1 );
end
end

local function chooseFood2 (e)
if e.phase==“ended” then
foodSelection2 = “Donut”
foodxForce = 0.5
foodyForce = 2
transition.to( foodBtn2, { time=1000, alpha=0, onComplete=killListener } )
print(“food:” … foodSelection2 );

end
end

local function chooseFood3 (e)
if e.phase==“ended” then
foodSelection3 = “Curry”
foodxForce = 1
foodyForce = 1
transition.to( foodBtn3, { time=1000, alpha=0, onComplete=killListener } )
print(“food:” … foodSelection3 );
end
end

local function chooseFood4 (e)
if e.phase==“ended” then
foodSelection4 = “Burgers”
foodxForce = -0.36
foodyForce = 1
transition.to( foodBtn4, { time=1000, alpha=0, onComplete=killListener } )
print(“food:” … foodSelection4 );
end
end

local function chooseFood5 (e)
if e.phase==“ended” then
foodSelection5 = “Burgers”
foodxForce = -0.36
foodyForce = 1
transition.to( foodBtn5, { time=1000, alpha=0, onComplete=killListener } )
print(“food:” … foodSelection5 );
end
end

feedGroup:insert(foodBtn1)
feedGroup:insert(foodBtn2)
feedGroup:insert(foodBtn3)
feedGroup:insert(foodBtn4)
feedGroup:insert(foodBtn5)

foodBtn1:addEventListener(“touch”, chooseFood1);
foodBtn2:addEventListener(“touch”, chooseFood2);
foodBtn3:addEventListener(“touch”, chooseFood3);
foodBtn4:addEventListener(“touch”, chooseFood4);
foodBtn5:addEventListener(“touch”, chooseFood5);

local killListener = function()
print(“food killed:” … foodSelection1 );
foodBtn1:removeEventListener( “touch”, chooseFood1 );
foodBtn2:removeEventListener( “touch”, chooseFood2 );
foodBtn3:removeEventListener( “touch”, chooseFood3 );
foodBtn4:removeEventListener( “touch”, chooseFood4 );
foodBtn5:removeEventListener( “touch”, chooseFood5 );
end
end

selectFood()

– END FOOD SELECT
[/code] [import]uid: 113162 topic_id: 22571 reply_id: 322571[/import]

Try removing “local” from line 107 and then on line 2 do

[lua]local killListener[/lua]

Let me know if that does the trick. [import]uid: 52491 topic_id: 22571 reply_id: 90114[/import]