Mike018 Posted February 2, 2018 Share Posted February 2, 2018 const filenames = ['test1', 'test2'] forEach(filenames, filename => { try { this.load.audio(filename, './audio/' + filename + '.mp3') } catch (error) { console.log('Failed to load:', filename + '.mp3') } }) Seems this.load.onFileError.add(console.log, this) doesn't work either. Link to comment Share on other sites More sharing options...
alex_h Posted February 2, 2018 Share Posted February 2, 2018 Audio loading is an asynchronous process. So the error won't necessarily be thrown from the initial call to this.load.audio, it may be triggered later on. Hence try / catch not working here. Link to comment Share on other sites More sharing options...
samme Posted February 2, 2018 Share Posted February 2, 2018 https://photonstorm.github.io/phaser-ce/Phaser.Loader.html#onFileError Link to comment Share on other sites More sharing options...
Recommended Posts