i have an error when changing priority of CCMenu object in onEnter() cuz touch delegate wasn’t add though i’m calling registerWithTouchDispatcher() before changing priority
heres the code:
void InviteFriendsDialog::onEnter() { CCLog("Entering"); //CCTouchDispatcher::sharedDispatcher()->init(); if(!this->getIsTouchEnabled()) this->setIsTouchEnabled(true); // calls registerWithTouchDispatcher() so dont need to call it CCLayer::onEnter(); //this->registerWithTouchDispatcher(); CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority-2, socialButtons); CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority-2, quitButton); }
`void InviteFriendsDialog::onExit()
{
CCTouchDispatcher::sharedDispatcher()->removeDelegate(this);
CCLayer::onExit();
}
void InviteFriendsDialog::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, kCCMenuTouchPriority-1, true);
}`