我的代码:
var queue = new createjs.LoadQueue(false);
queue.on('complete', onComplete, this);
queue.on('error', onError, this);
queue.on('progress', onProgress, this);
queue.loadManifest([
{ src: "images/ground.json", id: "1", type: createjs.Types.SPRITESHEET, crossOrigin:true }
]);
function onComplete(event) {
console.log('Complete', event);
init();
}
function onError(event) {
console.log('Error', event);
}
function onProgress(event) {
console.log('General progress', Math.round(event.loaded * 100));
}
使用这个 json:
{
"images": ["images/HauptmenuOhneButtons.png"],
"frames": [
[0, 0, 1920, 1080],
],
"animations": {
"background": [0]
}
}
我的结构是:
- index.html
- images/ground.json
- images/HauptmenuOhneButtons.png
我收到错误 FILE_LOAD_ERROR。
救命!
最佳答案
好的,您的 JSON 文件必须完美!
检查每个逗号! 最后一帧或动画后没有逗号。
{
"images": ["images/HauptmenuOhneButtons.png"],
"frames": [
[0, 0, 1920, 1080]
],
"animations": {
"background": [0]
}
}
关于javascript - PreloadJS 与 Spritesheet : FILE_LOAD_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49963131/