this.spine = this.getComponent(“sp.Skeleton”);
var image = “xxx/student_” + type + “.png”;
var ske = “xxx/student_” + type + “.json”;
var atlas = “xxx/student_” + type + “.txt”;
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, spineJson) => {
var asset = new sp.SkeletonData();
asset.skeletonJson = spineJson;
asset.atlasText = atlasJson;
asset.textures = [texture];
asset.textureNames = ["student_" + type + ".png"];
this.spine.skeletonData = asset;
this.spine._updateSkeletonData();
});
});
});

