CCFadeOut seems odd


#1

CCFadeOut seems can NOT support CCLayer object with its children.

Try it:

CCScene* scene = CCScene::node();

CCLayer* layerA = CCLayer::node();
scene->addChild(layerA);

CCSprite* spriteB = CCSprite::spriteWithFile("chicken/s-run-01.png");
layerA->addChild(spriteB);

spriteB->setPosition(ccp(200,200));
spriteB->setScale(0);
spriteB->runAction(
    CCSequence::actions(
    CCScaleTo::actionWithDuration(3.0, 1.0f),
    CCMoveBy::actionWithDuration(3.0, ccp(-100,0)),
    CCFadeOut::actionWithDuration(1.0),
    NULL ) );

CCDirector::sharedDirector()::runWithScene(scene);

It’s working properly.

Let’s change the code to:

CCScene* scene = CCScene::node();

CCLayer* layerA = CCLayer::node();
scene->addChild(layerA);

CCSprite* spriteB = CCSprite::spriteWithFile("chicken/s-run-01.png");
layerA->addChild(spriteB);

layerA->setPosition(ccp(200,200));
layerA->setScale(0);
layerA->runAction(
    CCSequence::actions(
    CCScaleTo::actionWithDuration(3.0, 1.0f),
    CCMoveBy::actionWithDuration(3.0, ccp(-100,0)),
    CCFadeOut::actionWithDuration(1.0),
    NULL ) );

CCDirector::sharedDirector()::runWithScene(scene);

Now, CCScaleTo and CCMoveBy are both working properly,
But CCFadeOut seems not worked

=== modified myself

setOpacity isn’t a method on CCLayer


#2

Because CCLayer doesn’t implement the interface “CCRGBAProtocol”, so it can not use CCFadeOut.