I’m not sure whether this is a bug or not, but it seems that, after using stage:setFocus to capture all future touch events (as described in the documentation), it is no longer possible to terminate touch event propagation by returning true. Example:
[code]local function onTouch(event)
print("Runtime:touch -> " … event.phase)
end
Runtime:addEventListener(“touch”, onTouch) – Unhandled touch events fall through to onTouch
local obj = display.newImage(“ball.png”)
function obj:touch(event)
if (event.phase == “began”) then
stage:setFocus(self)
elseif (event.phase == “ended”) then
stage:setFocus(nil)
end
obj.x = event.x
obj.y = event.y
return true – Doesn’t terminate propagation of touch events after stage:setFocus(self) has been called
end
obj:addEventListener(“touch”, obj)[/code]
The initial touch of obj doesn’t fall through to onTouch, since obj’s touch handler returns true. However future touch events, even tough they’re captured & handled by obj, do fall through to onTouch. Is this a bug?
[import]uid: 10327 topic_id: 3551 reply_id: 303551[/import]