Jump to content

Replace an audio file using the same key


AmAuron
 Share

Recommended Posts

Hi there, i want to know how should i adress this issue,

i have an audio file with the name "Kalimba", so for loading that to my game i used the function

this.audio.load('kalimba', 'assets/audio/kalimba.mp3');

Now my problem is i want to keep using the name "kalimba" (his key) but replace the file...so i want to overwrite it.

 

 

I searched the documentation and the audio file is the only type of file that doesn't have a replace parameter.

http://www.phaser.io/docs/2.3.0/Phaser.Loader.html#audio

So, my question is, how should i deal with this problem?

 

Thank you for your time to read this topic, hope you can help me :)

Link to comment
Share on other sites

Hey AmAuron,
 
you can calling the load method again in the preload function of your state where you need it. This works for me.

// Some statepreload: function() {    this.audio.load('kalimba', 'assets/audio/kalimba.mp3');}// Some other statepreload:function() {    this.audio.load('kalimba', 'assets/audio/newkalimba.mp3');}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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