你说的那个ArmatureTest方法,我看了,貌似它是指骨骼动画,不是帧动画吧?帧动画应该用的是ActionTimeLine.js中的方法吧?我的帧动画代码如下,一切都可以正常运行,
就是帧事件回调如何生效。如下:还请前辈细致指导啊。。
var FrameAnimationLayer = cc.Layer.extend({
runMan:null,
loop:null,
ctor:function(){
this._super();
/**
* 采用委婉的方法来进行帧动画的检测与操作,其中设置帧动画的事件监听失效。
*/
//加载frameAnimation界面的JSON资源分析,并获取frameAnimationScene对象。
frameAnimationScene = ccs.load(res.frame_animation_json).node;
// //将frameAnimationScene对象加入到layer中。
this.addChild(frameAnimationScene);
runManNode = frameAnimationScene.getChildByName(“ProjectNode_1”);
runManNode.runAction(cc.MoveBy.create(2, cc.p(300, 10)));
// this.scheduleUpdate();
//获取Node中的action
runMan = ccs.load(res.run_man_json).action;
frameAnimationScene.runAction(runMan);
//下面这句话没法生效。
runMan.setFrameEventCallFunc(this.frameAnimationEvent);
//运行动画,开始帧,结束帧,当前帧,是否循环。
runMan.gotoFrameAndPlay(0,20,true);
return true;
},
update:function(){
cc.log(runMan.isPlaying());
},
frameAnimationEvent:function(frame){
cc.log("Frame Animation Event");
}
});
var FrameAnimationScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new FrameAnimationLayer();
this.addChild(layer);
}
});