I have also an issue with the ControlButton. In cocos2d-x version 2.2.3 it was okay but in version 3.0b and 3.0rc0 I have the following problem. I created a new project by following the instructions in the README.md file. Then I added a listener for onTouchBegan to the EventDispatcher with the method addEventListenerWithSceneGraphPriority() … that is in the initialization of the HelloWorldScene.cpp. So when I tap the screen (the main and the only layer) I write something to the console. Everything okay. After adding the event listener I add a ControlButton to the layer (also in the init() method) as follows:
ControlButton* button = ControlButton::create("[ START ]", "Arial", 30); button->setPosition(Point(_screenWidth/2, _screenHeight/2)); button->addTargetWithActionForControlEvecoconts(this, cccontrol_selector(HelloWorld::onStartButtonClick), Control::EventType::TOUCH_UP_INSIDE); addChild(button);
The callback also prints somtething to the console. The problem is: the touch events are going through the button to the layer so both touches are recognized (both callbacks are fired everytime). I just can’t figure out what do I need to do to make the ControlButton swallow the touches. I tried with setting the touch priority, Z order, etc.
Thanks for your help!
can someone help us?
Is there anyone alive in this Forum???I have the same question!!!
I think it a bug for me i just fix it inside Control class just add where SwallowTouches