Teonnyn Posted February 27, 2019 Share Posted February 27, 2019 I have a system where I'm trying to load images from two sources remotely. They work half the time... but then a third of that, it suddenly attempts to add an additional http to the domain which causes the load to fail. I'm not 100% sure what is going on here, and it's been baffling. Part of it is that the images are being loaded in a loop - could that be causing the issue? This is the error that I'm getting: error loading asset from URL https:https://images.igdb.com/igdb/image/upload/t_thumb_2x/arlh24mn9p9x5blpuxqb.jpg This is the code I'm currently using: populateGameData(data) { if (this.gameData.length < 0) { for(let i = 0; i < this.gameData.length; i++) { this.game.cache.removeImage(this.gameData[i]['id']); } } this.gameData = []; this.gameData = data['gameData']; for(let i = 0; i < this.gameData.length; i++) { game.load.image(this.gameData[i]['id'], this.gameData[i]['gameImage']); } setTimeout( () => { game.load.start(); }, 3500 ); game.load.onLoadComplete.add(this.loadCheck, this); } loadCheck() { console.log(this.gameData[0]['id']); //let testImage = game.add.sprite(0, 0, this.gameData[0]['id']); } I do have allowed access to the images through Cors - has anyone else run into this problem before? Link to comment Share on other sites More sharing options...
quiphop Posted March 4, 2019 Share Posted March 4, 2019 Please be sure that images are loading at Preload function, then you should be able to use them in Create/Update/etc functions. populateGameData looks a bit weird Link to comment Share on other sites More sharing options...
Teonnyn Posted March 6, 2019 Author Share Posted March 6, 2019 I solved it. The issue turned out to be in the database, one of the images had an extra https:// attached to it that was getting corrected on the site, but was fooling Phaser. Link to comment Share on other sites More sharing options...
Recommended Posts