Detect when sprite image is loaded from URL?

Discussion and feedback on Construct 2

Post » Sun Aug 24, 2014 7:47 pm

Hi all,

I've been struggling with this one for about six months and I still can't seem to get a handle on it. I am creating a quiz program with about 400 image files. When the user goes to the next question, it reloads the layout, recreating the image sprite. The image sprite loads the next image, which has a delay that seems to vary between approximately 0.10 seconds to 10 seconds or more. While the sprite is loading, the texture previously loaded into the sprite occupies the space of the new sprite, distorting the previous image until the new image replaces the old. The new text loads instantly, but the image may take a while. This could lead to confusion where a user is looking at a new quiz question but still has the previous image (typically a graph).

Bottom line: the whole thing looks really sloppy and unprofessional.

Is there a way to detect when a sprite is loaded so I can just show a "Loading, please wait..." or "Tap to reload..." sprite until the image is loaded? I have tried doing this with a set time delay of 2 seconds, but sometimes it takes longer than this.

Would it be possible to get an "Image Loaded" callback similar to the callback that exists for AJAX?

Please see the attached sample .capx (Release 178). A demo of the delay is shown in the link below.

https://dl.dropboxusercontent.com/u/55106174/imageloadingdelay/index.html


The link below is the actual app, which loads from locally stored files. This is as clean as I can get it, but it still isn't right:

http://dl.dropboxusercontent.com/u/55106174/questionbank/index.html
You do not have the required permissions to view the files attached to this post.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
52
S
17
G
26
Posts: 432
Reputation: 18,084

Post » Sun Aug 24, 2014 9:02 pm

Sprite already has On image URL loaded condition.
B
34
S
9
G
3
Posts: 517
Reputation: 5,276

Post » Mon Aug 25, 2014 2:11 am

Sprite already has On image URL loaded condition.


Man do I feel like an idiot. :) Thanks for pointing this out!
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
52
S
17
G
26
Posts: 432
Reputation: 18,084


Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests