Detect when sprite image is loaded from URL?

  • 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

  • Sprite already has On image URL loaded condition.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • [quote:svf3wu7h]Sprite already has On image URL loaded condition.

    Man do I feel like an idiot. Thanks for pointing this out!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)