javascriptcreatejssprite-sheetpreloadjs

PreloadJS with Spritesheet: FILE_LOAD_ERROR


My code:

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));
    }

with this json:

{
"images": ["images/HauptmenuOhneButtons.png"],
"frames": [
    [0, 0, 1920, 1080], 
],
"animations": {
    "background": [0]
}
}

my structure is:

I get the Error FILE_LOAD_ERROR.

HELP!


Solution

  • OK, your JSON File has to be PERFECT!

    check every comma!! No commas after your last frame or animations.

    {
        "images": ["images/HauptmenuOhneButtons.png"],
        "frames": [
            [0, 0, 1920, 1080] 
        ],
        "animations": {
            "background": [0]
        }
    }