Scroll, CCMenu, TouchPriority and ccTouchEnded assert problem

Scroll, CCMenu, TouchPriority and ccTouchEnded assert problem
0.0 0


Hi everyone!

I have a weird problem with my application and I could not find anything on the internet… (Similar problems without answers).

I am posting here, hoping you may know what is wrong, so here is my problem :

I have a scrollview, that is composed of several “scrollrow”, nothing particular here. My problem is that each row is composed of several button, created as CCMenu. Everything works excepted when I want to scroll and I am pressing a button at the same time.

The problem is well known, the CCMenu “takes” the priority so it stops the scroll. (as I understand it).
So my solution was to change the priority of the CCMenu so the scroll would work!

For each CCMenu, I called “setTouchPriority(10);”, and then I was able to scroll, even if I begin by touching a button.

The new problem is that if I want to simply press the button (no scroll), my logcat (eclipse) shows me an error message for ccTouchEnded and x-code stops at the following line : “CCAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchEnded] -- invalid state");

So, from what I understand, the state of the button is not ok, which explains why it does not do what I want, but why is that ?
This error is linked to the change of priority but I can’t find how to make it work…

Also, if I begin to slightly scroll, but keep my finger on the button and then release, it will work as expected. It’s the simple press “down and up” that crashes everything…

Any suggestions is appreciated.

Thank you for reading,



Is anyone having the same problem as me ?

Please help :frowning:



Hello again,

It has been a while and I still haven’t find any answer…

Is anyone out there? :frowning:



Well it seems that your CCMenu do not receive ccTouchBegan but later it receives ccTouchEnded. Sounds like a bug. I can only advice you to debug it carefully and post some code to reproduce this bug so maybe someone will look at it. Alternatively you could try some hacks like calling ccTouchBegan from your code (but I don’t recommend it) or try to use controlls other than CCMenu like CCControlButton, maybe this one would work.

EDIT: Also you can check this thread: I didn’t read it but it seems related.



Maybe comments in that topic could help you: