Jump to content

Problem with DataURL Images on FireFox


G3n3ralTao
 Share

Recommended Posts

Hello,

I have a problem while using the DataURL to create dynamic image on FireFox. I came across this website http://codepen.io/ianmcgregor/pen/qkvcj where the image is directly added into the cache during the preload function and then added to a Sprite during the create function

I added it into my project and it work great on Chrome, but on FireFox when I call the Image from the cache I get an empty container with 0 width and height. If I reload the page the image is added and everything is working fine, but I need it to work on the first try (can't really ask the user to reload the whole page each time...). Is there a delay with the DataURL conversion on FireFox? Is there other ways to use DataURL beside the one described on the website?

Thank you in advance

Link to comment
Share on other sites

It's always like that... when I take time to formulate my problem parameter on a forum, I get a few idea on how to fix it. 

Turns out that the example on the website didn't add a onLoad function on the img before adding the DataURL at it's source. When the image was added to the cache, the async operation wasn't done. So now everything works smoothly!

If anyone got a more optimized solution for adding a Image from a DataURL to a Phaser Canvas, I am open to it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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