Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with basePath of LoadQueue #193

Closed
caiocanalli opened this issue Apr 11, 2016 · 10 comments
Closed

Problem with basePath of LoadQueue #193

caiocanalli opened this issue Apr 11, 2016 · 10 comments
Labels

Comments

@caiocanalli
Copy link

Hello developers!

I have a spritesheet loading problem. I'm generating a single file from the Animate CC. It contains two images that are mapped to one spritesheet. If I run my index.html file in the same location as the index.js file and folder images generated by Animate CC, everything works perfectly.

But if I move my index.js file and my images to another folder, the index.html file that performs charging, do not find the index.png file. The index.json file is normally found. In this case, my structure looks like this:

**http://localhost/web**/index.html

http: //localhost/files/index.js
http: //localhost/files/images/index.json
http: //localhost/files/images/index.png

In my index.html file in LoadQueue class, I pass the parameter basePath as http://localhost/files, as described in the Prelodjs documentation.

Is there any extra configuration in LoadQueue class?

Obs: Tested in Chrome, Firefox and Edge.

Thank you for your help.

@lannymcnie
Copy link
Member

Could be missing a trailing slash? Try http://localhost/files/ instead. You can also use ../files/ since it is all relative.

@caiocanalli
Copy link
Author

Sorry, I forgot to put the slash, but it was only in the commentary. In the code the path is correct.

Regarding the relative path, I can not use it that way because the js file and the images will be hosted on a different server where it will be my index.html file. So I'm using the parameter basePath.

On the Chrome network filter, the error is saying that LoadQueue class is looking for the image:

http: //localhost/web/images/index.png

That is, the same location where the index.html file is running. If the json file, it is found right on the way:

http: //localhost/files/images/index.json

Could this be a bug of LoadQueue class?

To reproduce this error, simply generate a file in Animate CC with some images, generating a spritesheet. Then just copy the js file and images folder to another folder.

In the index.html file, put in basePath parameter of class LoadQueue the address where it was placed the js file and images folder, as below:

var loader = new createjs.LoadQueue(false, "http://localhost/files/");

Thank you

@lannymcnie
Copy link
Member

If this is using a SpriteSheet (export from Animate), then there might be an issue where the basepath is not propagated to the SpriteSheetLoader, so all it's children are loaded without the basepath. You might have some success with a newer version. This issue was fixed for PreloadJS 0.6.2 (included in the 2015.11.26 release of CreateJS)

@caiocanalli
Copy link
Author

@lannymcnie, the Animate is generating the file with the latest version. I downloaded the github sources, and also displays the same error.

Is there any way to fix it until the next release?

Thank you

@lannymcnie
Copy link
Member

Might be a different issue. Any chance you have a live example.

@caiocanalli
Copy link
Author

Yes, I tried to upload a zip file with my example here, but I could not. Can I go through email, or is there any place I can put it?

@lannymcnie
Copy link
Member

Feel free to email it to me: lanny [at] gskinner [dot] com

@caiocanalli
Copy link
Author

Hello @lannymcnie, I sent the email. You received?

@fabian
Copy link

fabian commented Apr 20, 2016

Seeing the same issue - looks like there's already a proposed fix: #169

@dill0wn
Copy link

dill0wn commented Feb 26, 2018

I know this is an old issue, but I'm having the exact same issue with the 1.0.1 release here: https://github.com/CreateJS/CreateJS/releases/tag/v1.0.1

I have folder structure similar to the following:

http://localhost/games/mygame.html
http://localhost/cdn/mygame/assets/manifest.json
http://localhost/cdn/mygame/assets/data/somedata.json

So i do

var loader = new createjs.LoadQueue(false, "http://localhost/cdn/mygame/");
loader.loadManifest({ id: 'data', src: 'assets/manifest.json', type: 'manifest' }, true);

and the manifest looks like:

{
    "manifest": [{
        "id": "someData",
        "src": "assets/data/somedata.json",
        "type": "json"
    }]
}

It loads the manifest, but then fails to load any of the contents, getting 404 instead. The url attempted was http://localhost/games/assets/data/somedata.json

Is there something obvious I'm doing wrong?

Unfortunately due to the hosting situation outside of my control, I don't think I can change the path structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants