Question about tap events and overlapping shapes

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.

put return true at the end of your touch function, this will stop event to propagate and you will touch only the object on top

Thanks for the reply. That did the trick!

I tried adding return and all of a sudden I was getting both events. With return true I'm just getting the first. Seems to work but it's not what I expected.

views:1477 update:2011/11/14 9:16:56
corona forums © 2003-2011