Sprite Failure to Load Image Callback?

0 favourites
  • 3 posts
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • I have several hundred images included with the package as project files. For whatever reason, some of them are intermittently failing to load. Sometimes they work and sometimes they don't.

    My workaround is to try to reload the image if the image load fails.

    Is it possible to get a callback when an image fails to load from URL? I would like the system to automatically try to load the image again, rather than requiring some user input if the image doesn't appear. I tried to detect failure based on the size of the image (set size to 0,0, load image and resize to image size, then detect if the size is still 0,0 -> if so, then image failed to load), but my technique didn't work.

    Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Update: I was able to detect when the image doesn't load by detecting when the image height = infinity (>100000).

    The problem now is that the image will always load the first time, but if I later try to load the same image, all subsequent reloads of that image will fail until I leave the layout, load a different image, then go back to the layout and try again with the first image.

    [attachment=0:3r8dw6ii][/attachment:3r8dw6ii]

    The same problem occurs whether I am working on a desktop or an ipad.

  • Problem solved with the following workaround:

    1. Load a dummy image first.

    2. Next, load the desired image.

    This seems to work consistently. I still have no idea why I can't consecutively load the same image into a sprite.

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