Jump to content

Phaser 2 is sometimes incorrectly loading remote images?


Teonnyn
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

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