SkeletonAnimation 怎么获取事件帧名称

通过sp.Skeleton 的 注册监听 event中怎么获取事件帧名称

this._skeleton.setAnimationListener(this,(event,trackIndex,type)=>{
console.log(“事件”+event);
console.log(“type”+type);
console.log(“sp.Skeleton.START”+sp.AnimationEventType.START);
if (type == sp.AnimationEventType.START){
console.log(“开始动画”);
}else if (type == sp.AnimationEventType.END){
console.log(“结束动画”);
}else if (type == sp.AnimationEventType.COMPLETE){
console.log(“播放完成动画”);
}else if (type == sp.AnimationEventType.EVENT){
console.log(“动画事件”+ event);
}
});

我打印过回调了 。里面的参数都没有的动画事件名称。哪位知道的告知下,是我用错了么

首先,在 Creator 1.4 版本中,spine 组件的 setAnimationListener 设置的回调参数有发生变化,具体如下:

spine.setAnimationListener(this, (node, trackEntry, type, event, loopCount) => {
      // node 为 spine 组件对应的渲染节点
      // trackEntry 为 sp.spine.TrackEntry 对象
      // type 为事件的类型(sp.AnimationEventType 枚举值)
      // event 为事件对象(可能为 null)
      // loopCount 为循环次数(只有 type 为 sp.AnimationEventType.COMPLETE 时有意义,其他情况为 0)

      // 通过 event.data.name 获取事件名称
      if (event) cc.log('event name  : ' + event.data.name);
});

这样使用 event没有值。 我已经解决了 我通过这个方法 从新注册了
this._skeleton.setEventListener ((trackIndex,event)=>{
cc.log(this._eventCallBacks);
if (this._eventCallBacks[event.data.name]){
this._eventCallBacksevent.data.name;
}
});