Evolua
Evolua

Reputation: 11

PreloadJS - Does not load spritsheet image

I'm using PreloadJS to load a spritesheet.

The code was generated from the Animate CC, and is as follows:

function init(id, basePath) {

idAtividade = id;

images = images||{};
ss = ss||{};

var loader = new createjs.LoadQueue(true, basePath);
loader.addEventListener("fileload", handleFileLoad);
loader.addEventListener("complete", handleComplete);
loader.loadFile({src:"images/B02A10_Canvas_atlas_.json", type:"spritesheet", id:"B02A10_Canvas_atlas_"}, true);
loader.loadManifest(lib.properties.manifest) };

I have an application, located at the address localhost/web, which downloads the file using JQuery getScript method. Once the download is completed, JQuery performs my js file, and I call the init method, passing some parameters, among them the basePath where are the assets of this file.

The basePath spritesheet is as follows:

localhost/web/activities/1/

The js file containing this loading code, in the same place of spritesheet

B02A10.js

images / B02A10_Canvas_atlas_.json

images / B02A10_Canvas_atlas_.png

The json file is downloaded correctly, however, the png file is not found, because its address is not the same as last basePath in the constructor of LoadQueue class.

Your address looks like this:

localhost/web/images/B02A10_Canvas_atlas_.png

Is there any argument or setting to download the image is done using the last address in basePath?

Thank you.

Edit

The network filter image is here. It downloads the image once the correct path using the basePath. But he tries to lower it again, using one of my application. This is where the error occurs. And when it runs in the browser, the image does not exist.

Image with basePath downloaded correctly.

Image based application Path

Upvotes: 1

Views: 593

Answers (1)

Evolua
Evolua

Reputation: 11

It seems that fixed this problem. I have not had the chance to test since implemented an alternative method in my application.

This is the address of the discussion on GitHub PreloadJS where I got an answer:

https://github.com/CreateJS/PreloadJS/issues/193

Upvotes: 0

Related Questions