Karzam Posted March 15, 2015 Share Posted March 15, 2015 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 More sharing options...
Karzam Posted March 15, 2015 Author Share Posted March 15, 2015 That's working, I just find the damn error at the first line... My problem with Phaser is resolved, but I don't know why the hella canvas doesn't load images... Link to comment Share on other sites More sharing options...
afuriousengine Posted March 19, 2015 Share Posted March 19, 2015 Security issue. Run your project on a webserver (or even localhost://), you can't directly load off of the desktop Link to comment Share on other sites More sharing options...
Recommended Posts