the ControlButton event will never be activated!!!
first, add listener:
auto listener=EventListenerTouchOneByOne::create();
listener->onTouchBegan=CC_CALLBACK_2(DTDialogView::TouchBegan, this);
listener->onTouchEnded=CC_CALLBACK_2(DTDialogView::TouchEnded, this);
listener->setSwallowTouches(true);
this->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, bgDialog);
second, add controlbutton on this popup layer:
m_btnClose = ControlButton::create(spriteCloseButton);
m_btnClose->setPreferredSize(Size(40, 40));
m_btnClose->setZoomOnTouchDown(true);
m_btnClose->addTargetWithActionForControlEvents(target, selectorClose, Control::EventType::TOUCH_UP_INSIDE);
m_btnClose->setPosition(Point(260, 10));
m_btnClose->setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
bgDialog->addChild(m_btnClose, 902);
the ControlButton event will never be activated!!!