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

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...