Hi, I’m trying to dynamically generate a series of image objects on the screen and then have an event listener find out which one was clicked. I got as far as the code below but even that doesn’t work. Any pointers very welcome.
[lua]local button = display.newImage(“button.png”);
button.x = display.contentWidth/2;
button.y = display.contentHeight -50;
local function what_was_tapped(event)
print(event.target);
end
Runtime:addEventListener(“tap”, what_was_tapped);[/lua] [import]uid: 55068 topic_id: 10737 reply_id: 310737[/import]
[import]uid: 52491 topic_id: 10737 reply_id: 38958[/import]