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


#1

Hi,

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.


#2

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 = asset.data;
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


#3

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 = {				
id: asset.id,
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.


#4

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


#5

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.


#6

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


#7

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