[Plugin] Load Image from URL at runtime

Post your completed addons to share with the community

Post » Tue Nov 01, 2011 10:06 pm

I finished my first plugin. It will allow you to load an image from an URL at runtime. The image position/size is determined by where you place the object in the Layout screen.

You can download it from the following link:
LoadURLPlugin

Thank you!
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Wed Nov 02, 2011 6:02 am

This is cool, thanks Juantar!
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Wed Nov 02, 2011 8:24 am

thx man. good and useful plugin
B
21
S
5
G
2
Posts: 26
Reputation: 2,512

Post » Fri Nov 04, 2011 1:49 am

It's a useful plugin, but currently it miss some important functionalities.

Currently the image is loading in an unexpected position. In the layout editor the object has a centered hotspot, but in runtime the image has a top-left hotspot staying offset by half width and half height. It would be nice if you could choose the hotspot position in the properties panel like the Tiledbackground object, at least for the most relevant positions like top-left and center.

It would also be handy to have an "on image loaded" condition to trigger events when the image finished downloading and is displaying. And a "get image url" expression would also be very handy.

I suggest you to add a "set width" and "set weight" action, as well as a "get image width" and "get image weight" expressions to be able to proper control how an image is displayed. It would also be extremely important to have a "set position" action, as well as a "get X position" and "get Y position" expressions. It also misses basic actions for any visual plugin like "set opacity", "set visibility", and Z ordering actions.

Now I'm thinking that maybe it would be easier to mod a Tiledbackground plugin and add the load image from url functionality since all the other stuff are already in there.

I'm really interested in this plugin, hope you can make it more complete.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Sat Nov 05, 2011 2:34 pm

Thank you, Animmaniac, for your suggestion. I went ahead and created a new plugin ("Tiled Background From URL") based on the Tiledbackground plugin. It is pretty much the same plugin with the addition of allowing you to load the image at runtime and a condition that will let you know when the image has been loaded. I tested the hotspot and Opacity and they worked. I was not able to make the effects works. Anybody with more experience on Construct effects is more than welcome to mod this plugin to make it work with effects. The new download link is below:

Download new mod
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Thu Nov 17, 2011 4:36 am

Hi!
This is what I was looking for! Something to load images dynamicaly, but I just can't get this to work... it doesn't load my image :/ Can you post an example, please?

Thanks in advance!
B
17
S
4
G
3
Posts: 10
Reputation: 3,021

Post » Thu Nov 17, 2011 7:09 pm

Here is a small sample project:

https://sites.google.com/site/jptarqu/downloads/loadimage_test.zip?attredirects=0&d=1

One caveat (bug?) of the plugin is that it needs at least one sprite to be added to the layout. If there are no sprites, the image loaded from the URL won't draw into the canvas.

Also, I have not tested the plugin with the webgl option of the latest release.
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Sat Nov 19, 2011 9:05 am

Thanks, but in your example the image that should be loaded doesn't show up everytime I run it, that's what happens when I try to load an image :/
B
17
S
4
G
3
Posts: 10
Reputation: 3,021

Post » Tue Nov 22, 2011 10:22 am

@juantar: your plugin is good. I can even make it load base64 string representing images ! However, when I do that, (and the base64 is local), the image doesn't update in realtime. Do you have a solution ? (I think it's the same problem for Leos...)
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Nov 23, 2011 12:15 pm

I recently noticed that the tiled background version of the plugin will only load the images if called from certain conditions like "start layout".

The original version of the plugin (link at the first stop) should work when called from any condition as long as there is a sprite in the layout.

unfortunately, I will not be able to work on fixing the plugins for a few weeks, so if anybody wants to you are more than welcome to modify the source code and release the fixes.

Thank you all for your feedback!
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests