How do I link to a project file?

Get help using Construct 2

Post » Mon Sep 25, 2017 6:55 pm

Hi! I use the Sprite's "Load image from url" action, but I have a problem with the file's url: the manual says that any project file's url looks like "image.png" - and this works, but ony when previewing. When I export it (PhoneGap) it doesn't work at all. I guess this is because I locate project files in subfolders (e.g. Files/Images/subfolder/image.png), do I have to link project files with the full subfolder-path? For example "Images/subfolder/image.png". And if this is the problem, why does it affect only the exported version?

Thank you for your help.
B
21
S
7
G
1
Posts: 168
Reputation: 1,925

Post » Tue Sep 26, 2017 4:59 pm

Anybody?
B
21
S
7
G
1
Posts: 168
Reputation: 1,925

Post » Tue Sep 26, 2017 5:05 pm

Check and make sure you can load it in a browser first. If not, get the URL correct, then try loading it in your C2 app.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,867

Post » Tue Sep 26, 2017 5:36 pm

@gumshoe2029
ChesVCF wrote:the manual says that any project file's url looks like "image.png" - and this works, but ony when previewing.

As I said, there is no problem testing in a browser. Does anybody know where the problem is? Do I have to report it as a bug??
B
21
S
7
G
1
Posts: 168
Reputation: 1,925

Post » Wed Sep 27, 2017 7:30 pm

Ok, now I'm really clueless: when I export, "Load image from url Project File" only works if that image is one of the C2 icons that come by default in every capx (by the way, they are undeletable, they reappear if you try to remove them!). If you try to load any other image, it simply doesn't work. Please any kind of help would be truly appreciated.
B
21
S
7
G
1
Posts: 168
Reputation: 1,925

Post » Wed Sep 27, 2017 7:38 pm

If it only affects the exported version, it may be because the image you are linking to is redirected. Your computer and the phone may handle the redirection differently. When you open the image in your browser, do you get redirected to another URL? Does the "copy image link" gives you anything differently ?

In some rare cases, the website can block loading outside of specific useragent too, but this is not common at all.
B
17
S
9
G
4
Posts: 473
Reputation: 6,341

Post » Wed Sep 27, 2017 7:44 pm

B
21
S
7
G
1
Posts: 168
Reputation: 1,925

Post » Wed Sep 27, 2017 8:01 pm

And the exported app is running on your phone ? Do you have access to localhost on your phone, by being on the same wifi ? You may need to host it online if you want to do it like that, localhost is local. I may have missed something obvious though, sorry if I did
B
17
S
9
G
4
Posts: 473
Reputation: 6,341

Post » Wed Sep 27, 2017 9:02 pm

@Guizmus Yes, I export to Cordova and run my app on Android. I did preview over LAN in my mobile phone (yes, being on the same WiFi) and there was no problem at all. As I said, problem comes only when you run the APK file. I made a test capx where I can trigger the "Load image from URL" action in different ways and with different images, and it only worked with the C2 icons. This makes me suspect that it is either a bug that has to be reported or that project files have to be somehow preloaded before being shown (and for some reason C2 icons are automatically preloaded, I guess). What do you think?
B
21
S
7
G
1
Posts: 168
Reputation: 1,925

Post » Wed Sep 27, 2017 9:16 pm

It would be strange that it would have not been reported, but maybe... Did you try preloading the image in a sprite you don't show, prior to loading for your real object ?
B
17
S
9
G
4
Posts: 473
Reputation: 6,341

Next

Return to How do I....?

Who is online

Users browsing this forum: kriand and 69 guests