Skip to content

Problem with basePath of LoadQueue #193

Closed

Description

@caiocanalli

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.

Activity

  1. lannymcnie commented on Apr 13, 2016

    @lannymcnie
    Member

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

  2. caiocanalli commented on Apr 13, 2016

    @caiocanalli
    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

  3. lannymcnie commented on Apr 13, 2016

    @lannymcnie
    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)

  4. caiocanalli commented on Apr 13, 2016

    @caiocanalli
    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

  5. lannymcnie commented on Apr 13, 2016

    @lannymcnie
    Member

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

  6. caiocanalli commented on Apr 13, 2016

    @caiocanalli
    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?

  7. lannymcnie commented on Apr 13, 2016

    @lannymcnie
    Member

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

  8. caiocanalli commented on Apr 14, 2016

    @caiocanalli
    Author

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

  9. fabian commented on Apr 20, 2016

    @fabian

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

  10. dill0wn commented on Feb 26, 2018

    @dill0wn

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions