I created a piano keyboard using rectangles. I used white rectangle shapes for the white keys and black rectangles for the black keys.
I placed the white keys in a group and the black keys in another group. Then added both groups to another group. The black keys appear on top of the white keys.
While creating all of the rectangle shapes I added a tap event to each. They all use the handler function.
When I click, I'm using the simulator at this point, if I click an overlapping black box event.target is the white box underneath. If I click on a black box in the small space between two white boxes event.target is the upper black box.