Jump to content

Error While loading spritesheet as Data URI (base 64) image


Shubham Seth
 Share

Recommended Posts

I get warning in phaser 3
WebGL: INVALID_VALUE: texImage2D: no imageon chrome console
while loading the sprite sheet using dataURI (base64) image for first time loading the file and image will not load but after refresh or hard refresh it will auto remove warning and get all the image

var image= 'data:image/png , base64, "anyuri" ';
var image= 'data:image/png , base64, "base64" ';
var cardRandomDistribute = [image1, image2,];

for (var i = 0; i < 10; i++) {
       var cardsImg = new Image();
       var key = "cards" + i;
       cardsImg.onload = myFunction(i, key, cardsImg);
   }

}

function myFunction(i, key, cardsImg) {
   cardsImg.src = cardRandomDistribute[i];
   tempGame.textures.addSpriteSheet(key, cardsImg, {
       frameWidth: gameOptions.cardSheetWidth,
       frameHeight: gameOptions.cardSheetHeight
   });
}

Screen Shot 2018-09-07 at 2.15.58 PM.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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