ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

How to stop Touch dispatcher in inner Layer #36

Open sourceBreaker opened 12 years ago

sourceBreaker commented 12 years ago

Hi i am having problem of touch dispatching from a long time but now after a lot of tries i decided to ask you people .. :D

I created a layer A and layer B and then i add CCMenu in layer B and add layer B in layer A

now Layer A contains Layer B and Layer B contanis CCMenu

Now if i click on CCMenuItem then touches goes to CCMenu and is also dispatched to layer A i do not want to dispatch touch to layer A on touching CCMenu.

dustinanon commented 12 years ago

You need to claim the touch on the CCMenu, whenever you detect the touchevent, handle the event, and return true to the dispatcher. The dispatcher will not perpetuate the touch.