Evening fellow Corona geeks. I am stuck, and unable to find an answer to my problem. I am writing up a card type game, and I have created a table of buttons, and I am trying to add an event listener to the table so it will listen for touches on individual objects.
Here is what I have:
local topCardTable = {}
local idx = 0
for vVal = 1, 2 do
for hVal = 1, 4 do
idx = idx + 1
local topCard = display.newImageRect(“assets/UI-Art/NewCard2.png”, 194, 194)
topCard.x = (hVal * 210) + 95
topCard.y = (vVal * 210) - 100
topCard.xScale = 0.90;
topCard.yScale = 0.90;
topCardTable[idx] = topCard
topCardTable[idx].idx = idx
end
end
local function game(event)
if(event.phase == “began”) then
print(“object touched”)
elseif(event.phase == “moved”) then
print(“object moved”)
elseif(event.phase == “ended” or event.phase == “cancelled”) then
print(“object touch ended”)
end
return false;
end
Runtime:addEventListener( “touch”, game )
The runtime listener works great, but now I need to begin adding individual functions or statements to remove buttons upon clicking each one, and what I have above it not working. I think what I need is an event listener and/or function that is listening for actions in each object and this is where I am stuck. [import]uid: 212086 topic_id: 35985 reply_id: 335985[/import]