Jump to content

Setting baseURLs in preload


Recommended Posts

I am trying to load two different JSON asset packs in my preload(), and each has a different (and dynamic) path, so I need to define a different baseURL for each.  If I do something like this, it only uses the second baseURL for both files:

this.load.baseURL = 'path/to/content/';
this.load.pack('content_pack', 'assets_pack.json');

this.load.baseURL = 'path/to/otherContent/';
this.load.pack('otherContent_pack', 'otherAssets_pack.json');

If I set the paths in the JSON files, all loads fine; but unfortunately they will be dynamic paths.

From the LoaderPlugin.js docs, it states:

     * Once a base URL is set it will affect every file loaded by the Loader from that point on. It does _not_ change any file _already_ being loaded. To reset it, call this method with no arguments.

So it looks like the loader is queuing everything up, and since nothing has been loaded it's using the most recently defined baseURL.  To further complicate things I need to update a single progress bar with both asset loads combined.  Anyone have any tips on the correct way to handle this?  I guess the issue is that the baseURL and path are defined once for the loader, and not set for each pack load.  Thanks.


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...