With timer.performWithDelay and object.addEventListener the way I understand it is you need to provide a reference to the function listener like so:
function MyClass:setup( )
local function listener ( )
print("listener")
end
object:addEventListener("touch", listener)
end
However, rather than only being able to reference functions local to the where the event listener is added I would like to reference a function that is external, like so:
function MyClass:setup( )
object:addEventListener("touch", self.listener)
end
function MyClass:listener ( )
print("listener")
end
Now I know the above does not work, but I would like to know why it does not work, and also if there are any workarounds to make this work.
Any help is appreciated! [import]uid: 94248 topic_id: 27606 reply_id: 327606[/import]