ActionManager not playing animation Cocos2D-X v.2.2.1

ActionManager not playing animation Cocos2D-X v.2.2.1
0.0 0


For some reason ActionManager is not playing animation from a json file. I am not getting any error messages.

I took the exported files from SampleUIAnimation and copied it to my test project. I can load the .json file with no issues but I am not able to play the animation. Here is my code. Could someone advise if there is something I am missing.

UILayer *introLayout = UILayer::create(); introLayout->addWidget(GUIReader::shareReader()->widgetFromJsonFile("SampleUIAnimation/SampleUIAnimation.json"));
//add layout to CClayer

//Added a button event to trigger the animation
UIButton *btn = static_cast<UIButton*>( introLayout->getWidgetByName("TextButton")); btn->addTouchEventListener(this, toucheventselector(GameLayer::startAnimation));

//method to play animation on event trigger, but Animation is NOT playing
void GameLayer::startAnimation(CCObject* pSender, TouchEventType type)

if ( type == TOUCH_EVENT_ENDED )
> ActionManager::shareManager()->playActionByName("SampleUIAnimation/SampleUIAnimation.json", "Animation1");


Although it is written to [CCActionManager.cpp] as

ActionObject* ActionManager::getActionByName(const char* jsonName,const char* actionName)

possibly this ‘jsonName’ may be a meaning of ‘fileName’.

ActionManager::shareManager()->playActionByName("SampleUIAnimation/SampleUIAnimation.json", "Animation1");

The above-mentioned portion

ActionManager::shareManager()->playActionByName("SampleUIAnimation.json", "Animation1");

Please try.


There is no ActionManager::shareManager()->playActionByName() in cocos2d-x 3.0alpha1. What should I do?


You have to use ActionManagerEx for UI animations made with cocostudio.

cocostudio::ActionManagerEx::getInstance()->playActionByName(“SampleUIAnimation.json”, “SampleAnimation”);