creator dragonbone 使用
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 
 | onLoad(){let animNode = new cc.Node();
 animNode.parent = this.node;
 this.armatureDisplay = animNode.addComponent(dragonBones.ArmatureDisplay);
 this.armatureDisplay.addEventListener(dragonBones.EventObject.COMPLETE, this.animationEventHandler, this);
 cc.loader.loadResDir('dragonbone/effect/txk', (err, assets) => { // 动态加载需要放到resources目录中
 if(err||assets.length==0) return;
 for ( let i = 0; i < assets.length; i++ ) {
 if (assets[i] instanceof dragonBones.DragonBonesAsset) {
 this.armatureDisplay.dragonAsset = assets[i];
 }
 
 if (assets[i] instanceof dragonBones.DragonBonesAtlasAsset) {
 this.armatureDisplay.dragonAtlasAsset = assets[i];
 }
 }
 this.armatureDisplay.armatureName = "txk";
 this.armatureDisplay.playAnimation("wait_1", 1);
 });
 },
 animationEventHandler(event) {
 if (event.type === dragonBones.EventObject.COMPLETE) {
 this.armatureDisplay.playAnimation("wait_1", 1);
 }
 },
 
 | 
发现this.armatureDisplay.playAnimation(“wait_1”, 0); 循环播放动画,有时creator会报这个错误,原因待查。
可以考虑使用以上方法替代