Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am encountering a very strange problem with my cocos2d app. I add a sprite to the page and have an event handler linked to it which replaces the scene with another scene. On that page I have another button to take me back to the original scene. When I am back on the original scene, the eventHandler doesn't get fired when I click on the sprite. Below is the relevant code:

CCMenuItemImage *backBtnImg = [CCMenuItemImage
backBtnImg.position = ccp(45, 286);
CCMenu *backBtn = [CCMenu menuWithItems:backBtnImg, nil];
backBtn.position = CGPointZero;
[self addChild:backBtn];

EventHandler method (doesn't get called when the scene is re-entered):

(void)backButtonTapped:(id)sender {
    CCMenuItemImage *backButton = (CCMenuItemImage *)sender;
    [backButton setNormalImage:[CCSprite spriteWithFile:@"btn_back_pressed.png"]];
    [[CCDirector sharedDirector] replaceScene:[CCTransitionFade   
        transitionWithDuration:.25 scene:[MenuView scene] withColor:ccBLACK]];
share|improve this question

closed as too localized by Laurent Couvidou, Trevor Powell, Josh Petrie, bummzack, Sean Middleditch Dec 28 '12 at 7:12

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

This might be too localized to be useful to another reader. You can probably find the answer yourself with a bit of debugging. Check the faq for details on the kind of questions that are expected here. –  Laurent Couvidou Nov 26 '12 at 10:23
There has to be some other underlying problem. I made a super basic app using only your provided code (assuming MenuView is the same concept as the starting scene) and it worked just fine. Also, why are you creating a new menuItem within your event? –  Orin MacGregor Nov 26 '12 at 14:08
How did you navigate between scenes? I believe you have some issue when trying to get back from the top scene to the others. –  Setrio Nov 27 '12 at 12:31

Browse other questions tagged or ask your own question.