menu_selector How can i use it, in my custom button?

menu_selector How can i use it, in my custom button?
0.0 0


Hi there, thanks all the people here, you are best community ever :slight_smile:
I have one doubt, about how to create my custom button:
I have on class that inherits from CCSprite, and CCTouchDelegate

class Boton: public CCSprite,public CCTargetedTouchDelegate
@ Boton(void);@
@ virtual ~Boton(void);@
@ static Boton* createBoton(SEL_MenuHandler accion,char* imagen);@
@ virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);@
@ virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);@
@ virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);@
@ virtual void touchDelegateRetain();@
@ virtual void touchDelegateRelease();@
@ bool containsTouchLocation(CCTouch* touch);@
@ void onEnter();@
@ void onExit();@

@ SEL_MenuHandler _accion;@

In touch began i run this code
(CCRectMake(-s.width / 2, -s.height / 2, s.width, s.height).*_accion)(this);

The point is i want to launch a method from the button when the user clicks my custom Buttton.
Sometimes i managed to get that working but some cases i had this confusiing error….

void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, bool bPaused, unsigned int repeat, float delay)
@ CCAssert(pfnSelector, “Argument selector must be non-NULL”);@
@ CCAssert(pTarget, “Argument target must be non-NULL”);@
@ tHashSelectorEntry *pElement = NULL;@
@ HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement);@


Some ideas??Thanks all the comunity, you are awesome