Hi,
I have this code:
for i = 1,#imageSet do
local p = display.newImage(imageSet[i])
g:insert(p)
p:addEventListener( "touch", listener )
end
But terminal say me Runtime error assertion failed! on the line where I do addEventListener.
g is a display.newGroup()
and listener is defined as:
function listener(event)
print ("HIT")
return true
end
Any possible solution?
thanks.
David.
I have the same error and haven't been able to fix it yet... Anybody solved this?
Thanks
most likely your function "listener" is not defined before you add it to addEventListener.
most likely your function "listener" is not defined before you add it to addEventListener.
you the man!
Funny thing is I had 4 functions declared AFTER the addEventListener and they all worked just fine. But, as soon as I added a new one it would give me that error! weird uh?
cheers and thanks sooooo much for your help you prevented me from going to the psych ward.
adrian
global functions can be anywhere in the file
local functions must be declared BEFORE they are used...