Jump to content

Setting baseURLs in preload


prob
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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