How to plan Preloads more accurate way than inspector's checkbox

Hello, I’ve seen last entry talking about loading time.
Decreasing load times and optimizing performance: Preparing a Large project in Hype

But i wonder if there is a way to plan preloads by code or something else, so that it shows first page while it continue preloading, giving priority to the shown scene, but it doesnt¡ stop the preloading process.

We have considered spliting the project in parts, each one with a diferent html home, but we don’t like the way it jumps from HTML PAGE ot HTML PAGE. (blank screen)



Can you tell us a bit more about the size and type or project you’re working on? It will help us understand your use case. We’d like to offer more control over preloading in a future release!

There’s no built-in way other than the all-or-nothing preload checkbox to control resource preloading at the moment, but I do consider this a great feature request needed by many people.

However, you could write code yourself to do preloading. Basically you could do this as an on scene load event where you start downloading images needed by other scenes. Preloading is pretty easy; you can just make a dummy image and set the src to your URL (you’ll need to maintain your own list). Because of browser caching, once an image has been loaded it can be used by other elements without needing another load. The basic code looks like:

var completionHandler = (function (e) {
	img = this;
	// do something...	
img.onload = completionHandler;
img.onerror = completionHandler;
img.onabort = completionHandler;
img.src = resourcePath; /* some variable containing the URL */

You’d optionally need some code to prevent going to a scene where the image has not been loaded yet.

Note that this is only the case for images. If you want to preload audio, you must do that through Hype’s current mechanisms. Hype doesn’t preload video at all.