Dear all,
I want to click something then print the center x, y of that object (say, some image)
local image = display. new image (“1.png”)
image:setReferencePoint( display.TopLeftReferencePoint )
imagex, imagey = image:localToContent(0,0)
print(imagex…imagey) – up here it works
function click (object, event)
contentx, contenty = object: localToContent(0,0)
print (contentx…contenty) --it doesn’t work and return nil for localToContent
end
image:addEventListener(“tap”,click)
I have also tried to use object.x, object.y
but it end up return the x,y of where I have clicked.
Thanks!