Loading queue in background

My app will display a lot of images at different levels. That's why I want to implement a long preload-queue. This queue has to be set on pause when I need to display another set of images in seconds. How do I implement that in ZIM?

Hi Frank,

Each time you use F.loadAssets(assets, path); it returns a ZIM Queue() object. So you would want to use:

const load1 = F.loadAssets(assets, path);

// the CreateJS LoadQueue object is stored in the ZIM Queue's preload property
// to pause this you use the CreateJS LoadQueue's setPaused() method: 

load1.preload.setPaused(true);

// and then to unpause:

load1.preload.setPaused(false);

Let us know if you have any issues. Also, if you are using multiple asset loads then make sure your complete event is on the ZIM Queue object and not the Frame.

load1.on("complete", ()=>{});

// NOT

F.on("complete", ()=>{});

// as each Queue dispatches its own complete 
// and dispatches a complete to the Frame
2 Likes

Great! Thanx. And new for me is that an event is dispatched by the object. Hurray!

1 Like