I needed the same and I came up with code like this:
[lua]
local handleTouch = function(event,fragmentId)
if(event.phase == “ended”) then
print(fragmentId);
end
end
–
local handleTouchGenerator = function(fragmentId)
return function(event)
handleTouch(event,fragmentId)
end
end
– add evetns
piece.fragments[1]:addEventListener(“touch”,handleTouchGenerator(1))
piece.fragments[2]:addEventListener(“touch”,handleTouchGenerator(2))
[/lua]