TypeError when using AssetLibrary.fromManifest


#1

I am building an AssetLibrary using this code:

var manifest = new AssetManifest();
for(theAsset in assetsList){

	switch(getAssetType(theAsset.att.src)){
		case AssetType.IMAGE:
			manifest.addBitmapData ("assets/" + theAsset.att.src);
		case AssetType.TEXT:
			manifest.addText("assets/" + theAsset.att.src);
		case AssetType.BINARY:
			manifest.addBytes("assets/" + theAsset.att.src);
		default:
			manifest.addBytes("assets/" + theAsset.att.src);

	}

}

AssetLibrary.loadFromManifest (manifest).onComplete (function (library:AssetLibrary) {

		Assets.registerLibrary (libName, library);

	}).onError (function (e) {

	trace (e);
			
});

This compiles to HTML5 fine, but Flash gives this error:

TypeError: Error #1034: Type Coercion failed: cannot convert lime.utils::AssetLibrary@10a837cb9 to openfl.utils.AssetLibrary.
at MethodInfo-3709()
at MethodInfo-1144()
at lime.app::Promise_lime_utils_AssetLibrary/complete()
at lime.utils::AssetLibrary/__assetLoaded()
at lime.utils::AssetLibrary/loadImage_onComplete()
at MethodInfo-3124()
at lime.app::Promise_lime_graphics_Image/complete()
at MethodInfo-1926()

Any ideas?


#2

My relevant imports are:

	import openfl.utils.Assets;
	import openfl.utils.AssetLibrary;
	import openfl.utils.AssetManifest;
	import openfl.utils.AssetType;

#3

I have other hiccups now but I believe that adding this line has solved that particular Type Coercion problem:

manifest.libraryType = "openfl.utils.AssetLibrary";