Hi,
just wanted to understand the following
say,
local test = display.newRact(10,10,100,100)
test:setFillColor(255,0,0)
local handleTouch = function ( event )
if "ended" == event.phase then
print ("This one time only")
end
test:removeEventListener ( "touch", handleTouch )
end
test:addEventListener ( "touch", handleTouch )
Can we have a eventListener negator?
To remove an eventListener the function, etc has to be known or be the same. why can’t it just be a {} to remove/disable the event handler or a nil.
so instead of removeEventListener, it would be like
test:setEventListener ( touch,nil )
or
test:setEventListener ( "touch", {} )
which is much easier and this way it can be deactivated from the calling event itself and not cause crashes.
cheers, [import]uid: 3826 topic_id: 7465 reply_id: 307465[/import]