CreateJS / PreloadJS

PreloadJS makes preloading assets & getting aggregate progress events easier in JavaScript. It uses XHR2 when available, and falls back to tag-based loading when not.
http://createjs.com/
MIT License
2.87k stars 764 forks source link

Loading sprite sheets using manifest base path throws 404 #224

Open djipco opened 7 years ago

djipco commented 7 years ago

I think there is an issue with sprite sheet images loaded via a manifest when that manifest has a base path specified.

Here's how it goes. The manifest is loaded fine. It sees a request for a sprite sheet and loads it fine. This sprite sheet points to a png file. PreloadJS uses the base path from the manifest and loads the sprite sheet image. At this point, it should be done.

However, as I can see in the Network tab of the developers tools, it then tries to load the sprite sheet image once more without the base path. Of course, this does not work and throws a 404. Because of that 404, the image is not available and the sprite sheet does not work.

Manifest:

{
  "path": "ressources/" ,
  "manifest": [
    {"id": "random",  "src": "images/some-image.png"},
    {"id": "hero",  "src": "spritesheets/hero.json", "type": "spritesheet"}
  ]
}

Sprite sheet:

{
  "images": ["spritesheets/hero.png"],
  "frames": [
    [0,0,150,150,0,0,0],
    [150,0,150,150,0,0,0]
  ]
}

Am I missing something or this should work ? Obviously, if I remove the base path and use full paths everywhere, it works just fine.

P.S. I'm using preloadjs-NEXT.combined.js re-downloaded this morning.

lannymcnie commented 7 years ago

There are definitely some issues with sub-manifests (SpriteSheetLoader and ManifestLoader) and parent queue properties, such as basePath, maxConnections, etc. We are hoping to simplify this shortly, and hopefully address these issues.

djipco commented 6 years ago

I tried this again today using the latest version of the combined createjs.js file and the problem still stands. Is there an ETA on this?

lannymcnie commented 6 years ago

I don't think this is going to be a priority to add to 1.0, as it requires either a nasty hack approach, or a refactor.

We have an active internal branch for 2.0, which is getting a full refactor that should make this a non-issue.