cocos2d/cocos2d-x — pull request #6654 by zifter (2014-05-10 00:34:49+00:00)
Title: Add new functionality for managing scenes. Fix bugs, added example of use.

Now, next methods returning _nextScene.
Scene* popScene();
Scene* popToRootScene();
Scene* popToSceneStackLevel(int level);
This makes it possible to creating transition for popScene (or other).
Example of use:
Director::sharedDirector()->replaceScene(TransitionSlideInL::create(0.5,Director::sharedDirector()->popSceneBack()));
Similar pull request https://github.com/cocos2d/cocos2d-x/pull/3244

But this pull request is wrong, because Replace scene cleaning up _nextScene.
In method "replaceScene" now checks this situation.
Also, fixed bug with double calling onExitTransitionDidStart() and onExit() in popToSceneStackLevel for running scene.
Example of use for this functionality added to TestScene. Аdded more visual presentation for using this functionality.