I am having a problem with this code, when I call it basically I am loading a few images and assign a touch listener to each one. When I click on one of the images I want it to trigger the clicked function and pass it the argument which should be the value of grid[current]
Am I going about this the wrong way?
local grid = {}
local function create()
for i=0,4 do
for j = 0,3 do
current = i\*4 + j
grid[current] = display.newImage( current .. ".png")
grid[current].id = current
grid[current].x = 70 + (j\*110)
grid[current].y = 70+ (i\*140)
grid[current]:addEventListener ("touch", function() clicked(grid[current])end)
localGroup:insert(grid[current])
end
end
end
Thanks any help would be appreciated! [import]uid: 105129 topic_id: 28637 reply_id: 328637[/import]