.bundle won't load since openFL 8.1.1 (html5 target)


#1

Hi there,

Since openFL 8.1.1 and Lime 6.3.1, when we try to load a .bundle using
AssetLibrary.loadFromFile(“bundle/ui.bundle”);
we have a 404 error (or strange 0 error in minimalist test project)

[IOErrorEvent type=“ioError” bubbles=true cancelable=false text=“404” errorID=404]
[IOErrorEvent type=“ioError” bubbles=true cancelable=false text=“0” errorID=0]

The asset path is correct (loading work perfectly with openfl 7.1.2 and lime 6.2.0)

We use this command line to convert swf into .bundle
openfl process ui.swf ui.bundle

We have made a minimalist openfl project to test the loading, and we have the same error :


class Main extends Sprite 
{
	private var m_futureLib : Future<AssetLibrary>;
	
	public function new() 
	{
		super();
		m_futureLib = AssetLibrary.loadFromFile("bundle/ui.bundle");
		m_futureLib.onProgress(onProgress);
		m_futureLib.onError(onError);
		m_futureLib.onComplete(onComplete);
	}
	
	private function onError(e : Dynamic)
	{
		trace(e);
	}
	
	private function onProgress(prog : Int, total : Int)
	{
		trace(prog / total);
	}
	
	private function  onComplete(lib : AssetLibrary)
	{
		trace("done");
	}
}

with this project.xml :

<?xml version="1.0" encoding="utf-8"?>
<project>
	<!-- NMML reference: https://gist.github.com/1763850 -->
	
	<!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
	<meta title="testBundle" package="fr.test.testBundle" version="1.0.0" company="test" />
	
	<!-- output -->
	<app main="Main" file="testBundle" path="bin" />
	
	<window background="#000000" fps="60" />
	<window width="800" height="480" unless="mobile" />
	<window orientation="landscape" vsync="false" antialiasing="0" if="cpp" />
	
	<!-- classpath, haxe libs -->
	<source path="src" />
	<haxelib name="openfl" />
	<haxelib name="actuate" />
	
	
	<!-- assets -->
	<icon path="assets/openfl.svg" />
	<assets path="assets/bundle" rename="bundle" embed="false"/>
	
	<!-- optimize output
	<haxeflag name="-dce full" /> -->
	
</project>

We notice this change in Lime between the 2 versions : https://github.com/openfl/lime/commit/09923d5777bea5cbf9722bdf8c4eb0237b5dcedc

have we missed something about loading method ?

thx for help :slight_smile:


#2

Perhaps we should think about handling embed="false" differently.

We added support for “sub asset libraries” in recent builds, it works like this. When you have an <assets /> tag that includes a *.bundle file somewhere, it checks if it contains an asset library. If it does, it adds that as another library in your project.

For example, “assets/ui.bundle” would come through as a library called “assets/ui.bundle”, so the appropriate call would be like this:

Assets.loadLibrary ("assets/ui.bundle").onComplete (function (library) {

    trace ("done");
    
});

So instead of being a non-embedded asset in the “default” asset library, it gets added to your project as another asset library


#3

Seems to work perfectly on the minimalist project and our big project.

Thanks for this explanation !

:+1: :ok_hand: