0
votes

I am using the following code to switch from Helloworld Scene to levelmenu scene.

NSString *st=[NSString stringWithFormat:@"levelmenu"];
    CCTransitionFade *trans=[CCTransitionFade  transitionWithDuration:0 scene:[NSClassFromString(st) scene]];
    NSLog(@" before replaceScene");
    [[CCDirector sharedDirector] replaceScene:trans];
    NSLog(@" after replaceScene");

I have put an NSlog in levelmenu init also, But I am getting the console output as.....

2011-03-29 10:16:24.307 testProject[6574:207] init levelmenu
2011-03-29 10:16:24.787 testProject[6574:207]  before replaceScene
2011-03-29 10:16:24.787 testProject[6574:207]  after replaceScene
2011-03-29 10:16:24.860 testProject[6574:207]  dealloc

Can we change the order of calling above sequence, i.e after calling dealloc of menu init of levelmenu should be called.

1

1 Answers

0
votes

You shouldn't be using dealloc/init for this. You could try [CCNode onEnter]/CCNode onExit, which are called when your scene enters / leaves the screen.