How do I Load images form URL

  • Hi everyone,

    I'm facing an issue when i want to load an image from an URL to set it to a sprite.

    I use the action "Load image from URL" of the sprite but when i run the preview or when i export the projetct I have the following problems :

    • Google Chrome :

    Nothing happens.

    • IE :

    Javascript error => third party issue, bug construct 2.

    The sprite contents the texture of the closest sprite.

    I have a website with all the images and the URL of the images works.

    I read that it could be a browser issue, i don't know what you think about it.

    An idea ?

    Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Same here, nothing happens in Chrome unless it's a link from SoundCloud, very strange.

    If I take a picture from google or just any other website, nothing happens..

    Mhm, hopefully someone has a solution.

  • crossdomain security issue? it would probably work if you take the image from source on your own domain. if you upload your project, you could add a folder with images you want to load, these should work.

    Vaann , is the url of the images thesame a where your project is uploaded?

    edit: there's more on the subject from ajax plugin

    https://www.scirra.com/manual/107/ajax

  • Have you tried enabling cross-site scripting in the directory you are trying to pull images from? You can do it in .htaccess with

    Header add Access-Control-Allow-Origin "*"

  • Hi,

    Thank you for the answers, you were right about the htaccess, it works for IE and Mozilla now but still not for Chrome in preview.

    I don't know if it's due to the modification but now i can't run my game in Facebook anymore. It's stuck in a C2 loading bar.

    Do you have an idea ?

  • Vaann, just an idea, it could be that you need to clear the cache of chrome, the initial serversettings may yet be active,

    about facebook, not sure, maybe its something to do with the https, secure url settings, maybe theres some dev docs about it?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)