local function foo(event)
…
if … then
Runtime:removeEventListener(“enterFrame”, foo)
Runtime:addEventListener(“enterFrame”, bar)
end
end
local function bar(event)
…
If … then
Runtime:removeEventListener(“enterFrame”, bar)
Runtime:addEventListener(“enterFrame”, foo)
end
end
Runtime:addEventListener(“enterFrame”, bar)
-----> AddEventListener: Listener cannot be nil…
Are there any patterns to solve this problem?