yasdar 0 Report post Posted June 19, 2015 Hello,I have a game that uses many sounds , i don't want to load all sounds at the start of the game this will make this will make the player waiting for 5 min .I need to load one sound and play it when player click a button. i did this ://when player click a button this.game.load.audio("apple", ["assets/sounds/apple.mp3"]); var _sound= this.game.add.audio("apple");_sound.play('',0,1,false) but the console say :Phaser.Cache.getSound: Invalid key: "apple" any solution ?Thank you. Quote Share this post Link to post Share on other sites
drhayes 337 Report post Posted June 19, 2015 The sounds has not loaded yet by the time you're trying to add the audio. If you split your game into multiple states each state can have a preload function that loads assets that you use for that state. Quote Share this post Link to post Share on other sites
yasdar 0 Report post Posted June 20, 2015 Thank you for help drhayes.this is a good solution Quote Share this post Link to post Share on other sites