Hey i’m trying to remove an touch listener after touch him but the listener isn’t removing
local funcDeleta = function(e)
if e.phase == "ended" then
if trans1 then transition.cancel( trans1 ); end
if trans2 then transition.cancel( trans2 ); end
defense:play{ startFrame=1, endFrame=1 }
timer.cancel( tempoRemoveEnergyTorre )
energy = energy + ENERGY\_RECHARGE\_RATE
enable\_disable\_buttons()
update\_energy()
energiaGoldTorre:removeEventListener( "touch", funcDeleta )
local func1, func2, rectBranco
func1 = function()
transition.to( energy\_text,{ time = 500, xScale = 1.2, onComplete = func2 } )
end
func2 = function()
transition.to( energy\_text,{ time = 500, xScale = 1 } )
end
func1()
rectBranco = display.newRect( 0, 0, 60, 60 )
rectBranco.x = energiaGoldTorre.x
rectBranco.y = energiaGoldTorre.y
rectBranco.alpha = 1
grupoEnergia:insert( rectBranco )
transition.to( energiaGoldTorre, { time = 1500, x = 90, y = 120, alpha = 0, onComplete = function(e) display.remove(e); end } )
transition.to( rectBranco, { time = 1500, x = 90, y = 120, alpha = 1, onComplete = function(e) display.remove(e); end } )
end
end
energiaGoldTorre:addEventListener( "touch", funcDeleta )
anyone has an idea?
thanks [import]uid: 23063 topic_id: 33714 reply_id: 333714[/import]