Hello what is the difference between
local function onClick(but)
print("aa", but.name)
end
AND
function main:buttonListener(but)
print("aa", but.name)
end
I have
in my init file I want to use second one (the class method) but it does not work.
function main:init()
_sbtn1:addEventListener("click", onClick, _sbtn1) -- Works with local function well
_sbtn1:addEventListener(Event.MOUSE_DOWN, self.buttonListener, _sbtn1) -- Does not work.
end
BTW, my buttons are created and placed on stage on an another file but they are Global.
Comments