看 龙骨动画动态加载后,替换插槽资源无效。 这里引擎开发人员改过的代码
-
Creator 版本:2.2.2
-
目标平台: Web
-
详细报错信息,包含调用堆栈:
Failed to load resource: the server responded with a status of 404 (Not Found)
:7456
Failed to load resource: the server responded with a status of 404 (Not Found)
project.js:1 Uncaught TypeError: Cannot read property '_dragonBonesJson' of null
at y.<anonymous> (project.js:1)
at cocos2d-js-min.js:1
at cocos2d-js-min.js:1
- 重现方式:打包
- 主要代码:
let name = "weapon_1004_show"
const resources = [
cc.url.raw(`resources/${name}_ske.json`),
cc.url.raw(`resources/${name}_atlas.json`),
cc.url.raw(`resources/${name}_tex.png`),
];
cc.loader.load(resources, (err, assets) => {
let factory = dragonBones.CCFactory.getInstance();
let data = JSON.parse(cc.loader.getRes(resources[0])._dragonBonesJson);
factory.parseDragonBonesData(data);
let atlasData = JSON.parse(cc.loader.getRes(resources[1])._atlasJson);
factory.parseTextureAtlasData(atlasData, cc.loader.getRes(resources[2]));
});