spine骨骼动画只能在非web端换装调用skeletonData.getRuntimeData()报错
Simulator: E/jswrapper (271): ERROR: Uncaught TypeError: sp.spine.TextureAtlas is not a constructor, location: src/cocos2d-jsb.js:0:0
STACK:
[0]_getAtlas@src/cocos2d-jsb.js:52746
[1]getRuntimeData@src/cocos2d-jsb.js:52714
[2]_updateHero@assets/scripts/modeles/MainLayer.js:76
[3]start@assets/scripts/modeles/MainLayer.js:53
[4]anonymous@(no filename):3
[5]invoke@src/cocos2d-jsb.js:12015
[6]startPhase@src/cocos2d-jsb.js:12155
[7]mainLoop@src/cocos2d-jsb.js:7241
[8]callback@src/cocos2d-jsb.js:7476
贴上引擎代码
getRuntimeData: function(quiet) {
if (this._skeletonCache) return this._skeletonCache;
if (!(this.textures && this.textures.length > 0) && this.textureNames && this.textureNames.length > 0) {
quiet || cc.errorID(7507, this.name);
return null;
}
var atlas = this._getAtlas(quiet);
if (!atlas) return null;
var attachmentLoader = new sp.spine.AtlasAttachmentLoader(atlas);
var jsonReader = new sp.spine.SkeletonJson(attachmentLoader);
jsonReader.scale = this.scale;
var json = this.skeletonJson;
this._skeletonCache = jsonReader.readSkeletonData(json);
atlas.dispose(jsonReader);
return this._skeletonCache;
},
getSkinsEnum: false,
getAnimsEnum: false,
_getTexture: function(line) {
var names = this.textureNames;
for (var i = 0; i < names.length; i++) if (names[i] === line) {
var texture = this.textures[i];
var tex = new sp.SkeletonTexture({
width: texture.width,
height: texture.height
});
tex.setRealTexture(texture);
return tex;
}
cc.errorID(7506, line);
return null;
},
_getAtlas: function(quiet) {
if (this._atlasCache) return this._atlasCache;
if (!this.atlasText) {
quiet || cc.errorID(7508, this.name);
return null;
}
return this._atlasCache = new sp.spine.TextureAtlas(this.atlasText, this._getTexture.bind(this));
},