How do I detect if image loading failed in 'Sprite load URL'

Get help using Construct 2

Post » Thu Sep 01, 2016 3:57 pm

Sprite plugin in C2 has an action 'Load image from URL' where I can specify a URL of the image I want AnimationFrame should be loaded from. A corresponding event 'On image URL loaded' fires when the texture was successfully loaded from the web.

There are a lot of issues connected with this action when server blocks image loading due to 'Cross-Origin Resource Sharing policy'. In this case an error-message appears in the log-tab of browser and .. and there is no feedback of this action in C2 to somehow handle this problem (for example show any error-message or smth).

The more interesting thing happen when I try to load image texture from the server, which returns data with 'Content-type: text/html' headers.. to be precise, nothing happens (no error/warning messages in logs, no effect on animation frame).

It is demo-capx, showing the problem:

My question is the following: How can I detect an error occured while loading image texture from URL? Is it possible to realize in the 'stock version' of C2 in the next updates? If yes, it will be very nice to establish kind of 'connection' via animation_frame_index to understand which frame this 'error' or 'success' related to. (smth similar to 'tag system' realized in the AJAX plugin)
Posts: 22
Reputation: 4,883

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests