Preloader Progress Doesn't Update When Using "default" Library


Looks like when using, a

<library name="default" type="pak"/>

preloader progress bar doesn’t update, it just shows “empty” all the way while the default library loads.

To test this, I’ve used the PiratePig sample, adding the above line in project.xml (works just the same with pak or deflate), then, with Firefox dev tools disabled cache and throttled the speed to “regular 3G”.

I couldn’t find but 2 topics on the default library, so I’m not sure if this is a limitation or anything else.

Thanks for looking into this.

I think I found the problem:

The preloader uses the reported size of assets in order to estimate the load progress, as it downloads resources. Internally, the “packed” asset library is not setting any size for the assets.

Changing some of the further lines might help, for example:

var bytes:Bytes =;
bytes = bytes.compress (DEFLATE);
output.writeBytes (bytes, 0, bytes.length);
assetData.size = bytes.length;

Then running lime rebuild tools to recompile the tools.

I apologize that I can’t test this at the moment, I’m working on some big changes for the next release

thanks for the hint. i’ve tried it, but couldn’t make it work.

there’s something curious with the assetData structure, defined as:

var assetData:Dynamic = {				
size: 0,
type: Std.string (asset.type),
position: output.tell ()	

however, somewhere below, length is set, not size:

assetData.length = position - assetData.position;

i’ve tried using size instead of length, but still doesn’t seem to be working.

Hmm, have you tried setting both? Did you openfl rebuild tools and then rebuild your project after the changes?

hey, yeah, i did

assetData.size = assetData.length = position - assetData.position;

and openfl rebuild tools, also did what you suggested in the first post combined with the above, but no, doesn’t seem to go anywhere.

Oh, try and uncomment some of these lines in the PackedAssetLibrary class. You can make changes to that one without rebuilding tools:

thank you for the suggestion, but i’m afraid it doesn’t seem to have any effect on the progress bar.


Recently, I tried :
< library id=“minimenulib” type=“zip”/>
< assets path=“assets/images/minimenu” library=“minimenulib” rename=“minimenu”/>

			function(loaded, total) {
				bytesLoaded[i] = loaded;
				bytesTotal[i]  = total;
				trace(loaded, total);

Event onComplete working fine, but event onProgress seem not working on .pak.

It’s working when I’m not compress the file to .pak

Is there any solution?

It looks like it is not implemented:

Lime actually has added support for “Asset Bundles” which are zipped asset libraries different from this packed asset library design. That system is simpler (though granted – easier to unpack as a user) so I wonder if we could hook that up to type “zip” instead. All that does is load a zip (with progress events) then unzip it at the end