local object1 = display.newImageRect(…)
–some codes here
local object2 = display.newImageRect(…)
–some codes here
local object3 = display.newImageRect(…)
–some codes here
local object4 = display.newImageRect(…)
–some codes here
local object5 = display.newImageRect(…)
–some codes here
local object6 = display.newImageRect(…)
–some codes here
local function onButtonTouch1 (event)
if (event.phase == “began”) then
print("Touch event began on: " … event.target.id … "and the button was pressed ")
if(event.target.id == “button1” ) then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
if(rectangle == object1 )then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
object1 :removeSelf()
table.remove(myObjectTable)
elseif(rectangle == object2 )then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
object2:removeSelf()
table.remove(myObjectTable)
elseif(rectangle == object3) then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
object3:removeSelf()
table.remove(myObjectTable)
elseif(rectangle == object4)then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
object4:removeSelf()
table.remove(myObjectTable)
elseif(rectangle == object5) then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
object5:removeSelf()
table.remove(myObjectTable)
elseif(rectangle == object6) then --THIS IF STATEMENT DOES NOT WORK, PLEASE NEED HELP!
object6:removeSelf()
table.remove(myObjectTable)
else
event.target.id = nil
end
end
elseif (event.phase == “ended”) then
print("Touch event ended on: " … event.target.id … “and the button was not pressed”)
end
return true
local rectangle = display.newRoundedRect( …)
rectangle.id = “button1”
rectangle:addEventListener(“touch”, onButtonTouch1)