var spineNode = new cc.Node();
var skeleton = spineNode.addComponent(sp.Skeleton);
this.node.addChild(spineNode);
var image = “http://localhost/download/spineres/1/1.png”;
var ske = “http://localhost/download/spineres/1/1.json”;
var atlas = “http://localhost/download/spineres/1/1.atlas”;
cc.assetManager.loadAny([{ url: atlas, ext: ‘.txt’ }, { url: ske, ext: ‘.txt’ }], (error, assets) => {
cc.assetManager.loadRemote(image, (error, texture) => {
var asset = new sp.SkeletonData();
asset.skeletonJson = assets[1];
asset.atlasText = assets[0];
asset.textures = [texture];
asset.textureNames = [‘1.png’];
skeleton.skeletonData = asset;
});
});
官方提供的动态加载spine的方式有问题,会报: Can not render dynamic created SkeletonData