Getting "Load Image from URL" to work reliably in preview

0 favourites
  • 3 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • Heyllo!

    I'm working on a platformer where i'm drawing out trees in the background into the Paster Plugin. I first noticed some problems with using the Persist behaviour on Paster, also with Save game. In both cases the content would be lost if i switched layout.

    So i tried to load the image into a sprite when exiting the layout. The loading itself worked, but then again i got problems when switching layout. First i thought it had to do with the loading time, so i used "On Load", and tried putting different "wait x" all over the place, but i still couldn't get it to work reliably.

    In PREVIEW.

    When i export and upload the game it works fine. So then i thought it could have to do with this that i found in the manual:

    [quote:1rzyfd17]About sprites: "Images loaded from different domains are subject to the same cross-domain restrictions as AJAX requests - for more information see the section on cross-domain in the AJAX object"

    About AJAX: "If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header: Access-Control-Allow-Origin: * "

    So I'm trying to do this above now, but don't reall know how. Tried with the AJAX object to use "Set Request Header", but i don't know shit about network stuff, so i don't even know if it's the right action, or where to put it. Or if this is the problem. Any ideas? I'd post a .capx but it's a big messy project so it's gonna be some work to clean it out, so i thought I'd ask first if someone else got a hang of this.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • About AJAX: "If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header: Access-Control-Allow-Origin: * "

    This is a SERVER SIDE configuration, the server being the host of the file you are requesting from the client. It is configured in the HTTP server's configuration files, for example in Apache: https://stackoverflow.com/questions/291 ... in-apache2

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