I have been playing around with the ability to dynamically load sprites from a configuration file onto a layout, the goal being to pre-load a scene before displaying it.
The loading part when the layout is the current one works fine (see attached code):
When you click on the first button, an image is loaded into the first frame of the sprite, then clicking the second button creates another instance
of the sprite, then loads another image to its second frame (and so on for each image is the idea). After the last image is loaded, a flag is set, which
once the On Image loaded triggers, makes all sprites visible.
My problem is trying to do this on a layout which is not currently visible. I tried creating a layout 2, having the sprite on this layout (instead of layout 1) and using the same code I would load images, then move to layout 2 and make all sprites visible. As we need to move to another layout, I made the sprite on layout 2 persistent (otherwise all loaded images would be removed) and have both layouts using the same single event sheet.
For some reason, the On Image loaded event never seems to trigger in this second case (and no errors are shown in the browser's console). Does anyone have an idea why this happens or another idea on how to workaround this issue?
Perhaps Ashley could provide some insights onto how the load from url / on image URL loaded can/can't work between layouts?