event.currentTarget for Runtime:addEventListener, and group:addEventListener

hi,

it would be good if the events propagated to the item that was actually clicked on during a Runtime event, rather than having to add the listener to each object individiually

eg

[lua]local container = display.newGroup()
local ball1 = display.newImage(“ball.png”)
local ball2 = display.newImage(“ball.png”)

container:insert(ball1)
container:insert(ball2)

function onTouch(event)
print(event.currentTarget) – returns reference to ball1 or ball2, whichever was clicked
print(event.target) --returns reference to container? (need to check what flash does here)
end

Runtime:addEventListener(“touch”, onTouch)[/lua]

maybe to improve performance i could just add a listener on the group rather than the Runtime in general, so other unrelated objects didnt pick up the listener

[lua]container:addEventListener(“touch”, onTouch)[/lua]

again target would presumably return the container, and currentTarget would return the ball pressed
[import]uid: 6645 topic_id: 3461 reply_id: 303461[/import]

i think having this in the native engine would really benefit scenarios where you have 50-100 sprites on screen all with touch listeners.

when i add physics i’m getting a lot of performance drop on Android, with my drag event not responding properly. it starts ok but eventually, the objects lag and stop dragging. (although I do have it set at 60fps which could be an issue)

[import]uid: 6645 topic_id: 3461 reply_id: 10762[/import]