Jump to content

Problem for loading images


Karzam
 Share

Recommended Posts

Hi everyone, I'm tryin to draw a simple image with Phaser and I've a problem (the same I had yesterday with simple canvas html5)

 

Images seems to failed when loading and so they don't appears, only on Chrome and not in Firefox which work perfectly. I have an error : 

Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at file:///C:/Users/Baptiste/Desktop/Pixel%20Tank/assets/wall.png may not be loaded.

I tried to reinstall Chrome but it doesn't works and I'm coming crazy because yet I lost 2 days on that error. 

For my canvas problem yesterday it finally worked when I did a kind of preloader but I don't know why only on Chrome and not in Firefox, and I precise that I already used Canvas and I never had to do a preloader to draw an image...

 

Here is my code (so works perfectly on Firefox but not even on Chrome) : 

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'Pixel Tank', { preload: preload, create: create, update: update });// Préchargement des images function preload() {	game.load.image('sand', 'assets/wall.png');}// Initialisationfunction create() {	game.add.sprite(0, 0, 'sand');}// Boucle de jeufunction update() {}

Thanks for help ! 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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