CCTransitionCrossFade showing only solid black screen

I’m trying to fade between 2 scenes using CCTransitionCrossFade with the idea that it fades out of the current scene and fades into the next scene. My first question is that is this the right method to do so?

My seconds issue is that after implementing this, I get no transition at all. The current scene is replaced with a solid black quad which is then replaced by the new scene with no fading at all. After checking the warning log i noticed that this message is spammed.

“Cocos2d: cocos2d: removeChildByTag: child not found!”

the code I’m using to switch scenes are here:

CCScene *s = MainMenuScreen::scene(); CCTransitionScene *transition = CCTransitionCrossFade::create(0.5f, s); CCDirector::sharedDirector()->replaceScene(transition);

Does anyone know why this is happening?

I should also mention I’m using cocos2d-x and C++.

Also I have tried a couple of other transitions (tiles out and page turn) and both work fine. They just don’t suit the game so was really wanting to use the crossfade. I know I write something similar myself without much difficulty, but why reinvent the wheel right?

Hi Scott Hampson, try to modify ur code like this and try

CCScene *s = MainMenuScreen::scene();
CCDirector::sharedDirector()->replaceScene(CCTransitionCrossFade::transitionWithDuration(0.5f,s));

Thanks for the reply.

Your suggestion did not fix my problem. In fact there was no change at all in how the code was executed. transitionWithDuration through up a warning though saying that the method was deprecated.

Did you ever figure this out? I am getting the same thing on a few devices. It seems to happen to me when the graphics used are quite a bit bigger than the screen resolution (regardless of proper scaling).

I’m sorry, but no I didn’t find the solution. I ended up using a different transition.

Sorry again.

In case anyone else comes looking for an answer to this problem, I figured out what my issue was. Simply, the generated CCSprite for the CCRenderTexture had at least one dimension that was bigger than the device’s max texture size.

I solved this by creating a custom version of CCTransitionCrossFade that used 2 CCRenderTextures for the incoming scene and 2 for the outgoing scene - each being half of the win size.