Jump to content

Async music load


Recommended Posts



I try to make a music quiz game using Panda.js.

The lack of tutorials/samples is quite hard, but the api is so awesome I still want to dig in deeper.


I need to load a bunch of small audio files each time I enter on a scene. I need them not to be loaded as assets in the game bootstrap, but dynamically.


I'd like to, for instance, load a json file which contain an array of the files url to be loaded each time a scene.init is called ?

Is there a way to achieve it using Panda.js ?

Link to comment
Share on other sites

Yes you can do that. Here is a code sample that I use for similar purposes:

var wordsToDo = [{word:"rat", file: "L"}, {word:"bat", file: "L"}];//load soundfilesfor(var i=0; i<this.wordsToDo.length; i++){     game.addAudio('sound/' + wordsToDo.word + '.*', wordsToDo.word);}var loader = new game.Loader();loader.onComplete(this.yourFunction.bind(this));loader.start();
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.

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.


  • Recently Browsing   0 members

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