Hi to all,
I save a BitmapData as:
let dataUri = this.bmdDraw.canvas.toDataURL();
localStorage.setItem(this.prev_image_key, dataUri);
Then i try to load data this way.
My code:
let localDataUri = localStorage.getItem(this.image_key);
let data = document.getElementById(“temp_img”);
data[‘src’] = localDataUri;
this.game.cache.addImage(randomKey, localDataUri, data);
this.bmdDraw.load(randomKey);
And I get a next error when adding a picture to the cache:
Phaser.Cache.AddImage: Image “randomKey” hasn’t been retrived yet
But the image is uploaded to the temp_img web element.
What am I doing wrong? How can I save and load BitmapData correctly?
Thanks!