Get nodes timeline from Cocos Studio scene

Hi guys,
I’ve always loaded a timeline and ran it as an action on a scene node to allow me to play animations on it from code etc. You can get nodes to play animations from within cocos studio itself though through careful keyframing and the Action track. ( I think that’s what it’s called from memory).

All has been good with this but now I find myself needing to add a Frame Event callback to this node. It’s easy for the time line I loaded myself as I’ve kept the pointer to it, but the animation that was setup in cocos studio has its own timeline action running and I cannot figure out how to get hold of that to register my Frame Event callback. The Action system only seems to offer ways to get actions by tag but i have no idea what tag it would have.

Perhaps another approach would be to register some global Frame Event handler if that’s possible? I’m open to ideas!

I think I’ve figured it out. I can get the ActionTimeline created by the scene itself with this:

cocostudio::timeline::ActionTimeline* pActionTimeline = (cocostudio::timeline::ActionTimeline*)pNode->getActionByTag(pNode->getTag());

It looks like by getting this Action Timeline I can avoid loading the timelines in C++ for particular nodes at all, which I’d been doing with this:

cocos2d::CSLoader::createTimeline("layerwithanim.csb");

I’ve put this up here as reference for others.

Another note - It seems that I can’t always use this approach.

I have some nodes in a scene which are all instances of the same layer. It seems in these cases the last node loaded is given an ActionTimeline instance but the others are not. I think this is related to a bug I’ve seen before where you can animate many instances within a scene in Cocos Studio but when ran in the game itself only the last instanced node gets any animation. (though strangely not the Cocos Studio built in simulator - perhaps that’s not running a C++ build but lua or js or something?).

Maybe it’s because only one animation timeline can be loaded from a file. I’ve seen this before, don’t know whether it is true or not now.