Loading multiple asset bundles


#1

Hi,
I have just started working with Haxe today and was trying to load multiple bundles that I created using openFL (openfl process 1.swf) but couldn’t find anything like LoadQueue for the loader.

This works fine for the first bundle -
loader = new Loader ();
loader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, loader_onProgress);
loader.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, loader_onError);
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, loader_onComplete);
loader.load (new URLRequest (“http://localhost:2000/1.bundle”));

I am looking for something like AssetManifest /LoadManifest which can allow me to load all the bundles and add the respective contents.

Appreciate your help.

Thanks in advance!


#2

Are you using the Haxelib release, or the NPM one?

In the Haxelib release, you can add <library path="assets/1.swf" preload="true" /> to add the library to the preloader, to be loaded automatically at start-up. There’s no official batch way to group multiple asset library loads together other than this approach, but I would like to see improvements in this area


#3

Thanks @singmajesty ! I am yet to try this, but will it work if I have to get the details of my assets at run time based on the server response.
I am working on a customization app / dressing game and I will have to load 1, 2, 3… N.swf files (based on the response from the server) and render them in sequence to create the final look of the character.
It was originally done in Flash and I need to convert all of that to HTML5.

If you could share references, it would really really help.

Thanks so much!


#4

I believe you can use Loader for doing this in OpenFL, similar to how you would do it in Flash. Flash has no way to batch multiple Loader objects together, so you would have to write your own, but if you are doing a port, perhaps that existing code can work?