When a touch event is received it can be stopped from being propagated any further by the listener function returning ‘true’. This does not appear to be the same for events dispatched manually via the ‘object.dispatchEvent’ function.
For example, the following will print two ‘fire’ statements to the console, not one, when I believe that it should only print one because the first display object’s event listener returns ‘true’.
Has this behaviour changed or is this the intent? It would seem to me that the cancellation of event propagation would be useful if it behaved the same in both scenarios.
[lua]local a = display.newCircle(100,100,50)
local b = display.newCircle(300,100,50)
function a:fire(e)
print(a, e.name, e.target)
return true – this should cancel the event IMHO
end
function b:fire(e)
print(b, e.name, e.target)
return true
end
Runtime:addEventListener(“fire”, a)
Runtime:addEventListener(“fire”, b)
Runtime:dispatchEvent{ name=“fire”, target=a, }[/lua] [import]uid: 8271 topic_id: 35301 reply_id: 335301[/import]