Hi,
2 want to display 2, or 4 rects and connect then with an touch event, but “t_R[i]:touch( event )” is not working.
What did i worng ?
local t_R = {
display.newRect( 0, 0, display.contentWidth / 2, display.contentHeight ),
display.newRect( display.contentWidth / 2, 0, display.contentWidth, display.contentHeight )
}
–local t_R = {
– display.newRect( 0, 0, display.contentWidth/2, display.contentHeight/2 ),
– display.newRect( display.contentWidth / 2, 0, display.contentWidth, display.contentHeight/2 ),
– display.newRect( 0, display.contentHeight/2, display.contentWidth / 2, display.contentHeight ),
– display.newRect( display.contentWidth / 2, display.contentHeight/2, display.contentWidth, display.contentHeight )
–}
for i = 1, #t_R do
t_R[i]:setFillColor(i+i*10, i+i*20, i+i*20)
print (“filled”)
– function not working
function t_R[i]:touch( event )
if event.phase == “began” then
print (“touched”)
return true
end
end – func
t_R[i]:addEventListener( “touch”, t_R[i] )
end