Help on event.target inside of a table.

I have a function that remove an object

function killNote (event)         local object = event.target         display.remove(object)     return true end

And a displayed image that I add an event listener

local trebleClef = display.newImageRect("images/trebleClef.png", 71, 182)     group:insert ( trebleClef )     trebleClef.x = centerX - 450     trebleClef.y = centerY - 183     trebleClef:addEventListener("tap", killNote)

And it works perfect, if I tap the image it’s gone!

I want to do the same idea, but I have a ‘for’ loop where I created 5 images

And I just don’t know where or how I have to add the event listener I think it’s like this

but id doesn’t work

local quarterNoteTable = {}     local indexNote = 0         for row = 1, 5 do             --for column = 1, 2 do             indexNote = indexNote + 1             quarterNoteUp = display.newImageRect("images/quarterNoteUp.png", 38, 101)             quarterNoteUp.x = (row \* 200) - 20             quarterNoteUp.y = 206             --whiteKey.y = column \* 104             quarterNoteTable[indexNote] = quarterNoteUp             group:insert ( quarterNoteTable[indexNote] )             --end             transition.to(quarterNoteUp[indexNote], {time=1000, x=(row \* 100) - 20, y=206})             quarterNoteUp[indexNote]:addEventListener("tap", killNote)         end

Thanks for all your help

Victor

it looks like your last lines should be:

 -- quarterNoteTable, not quarterNoteUp transition.to(quarterNoteTable[indexNote], {time=1000, x=(row \* 100) - 20, y=206}) quarterNoteTable[indexNote]:addEventListener("tap", killNote)

dmc

it looks like your last lines should be:

 -- quarterNoteTable, not quarterNoteUp transition.to(quarterNoteTable[indexNote], {time=1000, x=(row \* 100) - 20, y=206}) quarterNoteTable[indexNote]:addEventListener("tap", killNote)

dmc