How do I Load images form URL

Get help using Construct 2

Post » Sat Mar 29, 2014 12:04 pm

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.
B
2
Posts: 2
Reputation: 154

Post » Sat Mar 29, 2014 3:43 pm

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.
B
5
S
1
Posts: 17
Reputation: 387

Post » Sat Mar 29, 2014 6:32 pm

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
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Sat Mar 29, 2014 11:09 pm

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 "*"
B
9
S
3
Posts: 37
Reputation: 749

Post » Sun Mar 30, 2014 3:06 pm

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 ?
B
2
Posts: 2
Reputation: 154

Post » Sun Mar 30, 2014 4:11 pm

@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?
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 42 guests