1

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

Community
  • 1
  • 1
Evolua
  • 11
  • 2
  • Could you use the Web Developer tools in Chrome and check the network filter to see what is being loaded and from where? – Berni Apr 08 '16 at 13:53
  • @Berni, I edited the post with more details – Evolua Apr 08 '16 at 14:47
  • Have you tried manually entering the base path? – Berni Apr 08 '16 at 16:06
  • Yes @Berni. If I put the base path into the json as {"images": ["**localhost/evolua/midias/atividades/2/images/B02A10_Canvas_atlas_.png**"], "frames": [[1026,5418,1024,40]]} it works correctly. But in this case, I need this address is dynamically added through the basePath. – Evolua Apr 08 '16 at 16:16
  • Try to mirror your local development area with your production development area, so that folder names and paths are the same. – Berni Apr 10 '16 at 07:04
  • Sorry @Berni not understand your suggestion. Here in the forum of Adobe I described this same problem. Maybe some information more. https://forums.adobe.com/thread/2135927 – Evolua Apr 11 '16 at 14:46

1 Answers1

0

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

Evolua
  • 11
  • 2
  • Welcome to Stack Overflow, While the link you provided may answer the question, it is best to put the essential parts of your solution directly in your answer in case the page at the link expires in the future. – Kmeixner May 09 '16 at 13:01