在网页上调用需要加载资源完成后在调用 现在有个问题 在网页上显示不出来 也没有抛出异常 在
simulator下是能显示出来的
cc.loader.load([".json",
".atlas"],
function () {
var spineBoy = new sp.SkeletonAnimation('.json', '.atlas');
spineBoy.setPosition(cc.visibleRect.width / 2, cc.visibleRect.height / 2);
spineBoy.setAnimation(0, '动画名字', true);
this.addChild(spineBoy, 4);
this._spineboy = spineBoy;
spineBoy.setEndListener(function (traceIndex) { //设置结束事件监听器。 动画停止播放时调用
//cc.log("%d end.", traceIndex);
});
spineBoy.setCompleteListener(function (traceIndex, loopCount) { //动画结束事调用-- loopCount 循环的次数 traceIndex动画的索引
//cc.log("%d complete: %d", traceIndex, loopCount);
});
spineBoy.setEventListener(function (traceIndex, event) {
cc.log(traceIndex + " event: %s, %d, %f, %s", event.data.name, event.intValue, event.floatValue, event.stringValue);
});
}, this);
cocos js Spine sp.SkeletonAnimation
最新推荐文章于 2020-07-22 11:09:45 发布