Runtime error asserion failed

Hi,

I have this code:
for i = 1,#imageSet do
local p = display.newImage(imageSet[i])
g:insert§
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.
[import]uid: 44539 topic_id: 8586 reply_id: 308586[/import]

I have the same error and haven’t been able to fix it yet… Anybody solved this?
Thanks
[import]uid: 12407 topic_id: 8586 reply_id: 44255[/import]

most likely your function “listener” is not defined before you add it to addEventListener. [import]uid: 48521 topic_id: 8586 reply_id: 44279[/import]

most likely your function “listener” is not defined before you add it to addEventListener. [import]uid: 48521 topic_id: 8586 reply_id: 44280[/import]

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
[import]uid: 12407 topic_id: 8586 reply_id: 44486[/import]

global functions can be anywhere in the file

local functions must be declared BEFORE they are used… [import]uid: 6175 topic_id: 8586 reply_id: 44638[/import]