I have a some of questions regarding event bubbling, which I really hope to clarify:
-
When using a TableView/ScrollView on 70% of the screen height (using a MaskFile and all that), and having buttons (images with touch events) on the remaining 30% of the screen, clicks to the buttons makes the TableView/ScrollView move IF THE TABLEVIEW/SCROLLVIEW HAS CONTENT THAT IS TALLER THAN THE VISIBLE SCREEN AREA. This must surely be a bug, since the buttons are outside the mask file area. Anyway, how to handle it?
-
Should event handlers return true even if they didn’t handle the event? Some example code seems to suggest this:
function eventHandler(event)
if shouldHandleEvent()
handleEvent()
end
return true
end
I would imagine this would be more correct:
function eventHandler(event)
if shouldHandleEvent()
handleEvent()
return true
end
end
-
This is related to question 2: Let’s say I want to handle event.phase “ended”. Should I return true only if I detect an “ended” phase, or should I return true when detecting “began” too?
-
Do table listeners work better than function listeners for event handling? I seem to get more correct event calls and less propagation problems when I use table listeners.
– This seems to work better
function object:touch(event)
– handle the event
end
object:addEventListener(“touch”, object)
– This seems to work less good
function handler(event)
– handle the event
end
object:addEventListener(“touch”, handler)
Thanks in advance! [import]uid: 73434 topic_id: 31968 reply_id: 331968[/import]