newRect not firing touch event

Hi,

I have created a rectangle, made it invisible and set it to fre the ontouch event. However, it does not fire when invisible, but will work when visible. Any help is appreciated.

local myImage = display.newImageRect(“template22.png”,960,640)
myImage.anchorX = 0
myImage.anchorY = 0

local square1 = display.newRect(135,64,80,128)
square1.isVisible = false
square1.isHisTestable = true
square1:setFillColor( 0.5 )
–square1.alpha = 0
square1.id = “test”

local function onObjectTouch( event)
    if event.phase == “began” then
        print(“touch event began on :” … event.target.id  )
    end
    return true
end

square1:addEventListener( “touch”, onObjectTouch)
 

typo here. 

Also, ensure you have no ‘tap’ events interfering with this ‘touch’ event (e.g. another ‘tap’ event at the same location)

square1.isHisTestable = true

Thanks for catching that typo, yosu!

typo here. 

Also, ensure you have no ‘tap’ events interfering with this ‘touch’ event (e.g. another ‘tap’ event at the same location)

square1.isHisTestable = true

Thanks for catching that typo, yosu!