Haxe + OpenFL won't run. Missing "default" asset library?

I recently bought a new computer. I installed FlashDevelop (as well as lime via the haxelib). I’m scripting with Haxe, targeting HTML5. When I run my programs, I’m only getting a black screen in Chrome. When I F12, it shows this error being thown (see arrow below):

lime_utils_Log.error = function(message,info) {
if(lime_utils_Log.level >= 1) {
	var message1 = "[" + info.className + "] ERROR: " + message;
	if(lime_utils_Log.throwErrors) {
		throw new js__$Boot_HaxeError(message1);   <---------
	} else {
		console.log(message1);
	}
}
};

I should also add the error in the console: "There is no asset library named "default"", message: "[lime.utils.Assets]"

Any advice would be greatly appreciated. Thank you.

Have you tried any OpenFL samples? Does this occur with PiratePig, DisplayingABitmap or other samples?

1 Like

Pirate Pig seemed to require SWF from the haxelib library (which is a different error than what I’m getting). It’s as if my asset folder is not being found or something.

It should also be noted that when I start new projects, they work. It’s just the older projects (saved in a Dropbox folder) that are throwing the asset error.

What versions of Lime, OpenFL and Haxe are you using?

Can you try a -clean build of your old projects, perhaps it will work differently?

Haxe 3.4.0 and the other two I downloaded via the command prompt so they should be up to date (not sure how to check those). The -clean options didn’t work. I just don’t get it. I use FD on multiple computers and am not sure why this new one is throwing that error.

Haxe 3.4.0 has some known problems, perhaps Haxe 3.4.2 would work better?

I did, but still getting the error. I’ll try to re-download lime 5.1 and reinstall that.

Just don’t get why new projects work fine, but by former ones do not.

Thanks for keeping on this.

I was able to track this down as where (in the code) I think the error is being generated:

var limeFont = lime_utils_Assets.getFont(id,false);

and

lime_utils_Log.error(lime_utils_Assets.__libraryNotFound(symbol_libraryName),{ fileName : "Assets.hx", lineNumber : 172, className : "lime.utils.Assets", methodName : "getAsset"});

and

return lime_utils_Assets.getAsset(id,"FONT",useCache);

and

Main.iceFormat = new openfl_text_TextFormat(openfl_utils_Assets.getFont("fonts/RumRaisin-Regular.ttf").name,20,0,null,null,null,null,null,0);

I’m so lost…

Could you try the “AddingText” sample, then add your font, and try your font instead of the one included in the sample, if you think the font may be to blame?

If its one specific project that is not working, you may be able to share it privately in case something particularly unusual is going on

After a LOT of digging and trial and error, I confirmed that the fonts were causing some type of problem, so I removed STATIC from their declaration. The compiler seemed to like that but now my sound asset(s) are throwing this error:

 [lime.utils.Assets] ERROR: SOUND asset "sounds/timesUpSound.mp3" exists, but only asynchronously

I have also confirmed that this problem exists on all projects both new and old, my own or other. It’s something with the ASSETS.

How do I completely clean LIME out of my PC and do a brand new install?

Confirmed. If I take out my sound files, everything appears to work fine.

Had the same problem. Long story short: don’t call Assets in static constructors, because Assets may still not be initialized yet

2 Likes

Makes sense, except (for whatever reason) I was only calling my fonts that way. My sound assets look like this:

public var shotSound:Sound = Assets.getSound("sounds/shot.mp3");

Which throws this error in the browser’s console:

[lime.utils.Assets] ERROR: SOUND asset "sounds/timesUpSound.mp3" exists, but only asynchronously.

Thanks for your feedback, Lion123

Had the same problem. Long story short: don’t call Assets in static constructors, because Assets may still not be initialized yet

I’m having the same problem with DisplayingABitmap sample project. How I can move the Assets call from its constructor which can execute after initialization is completes? (Sorry, I’m a newbie :slight_smile:)

I tried to call Assets in Event.ADDED_TO_STAGE, but thrown same error:
this.addEventListener(Event.ADDED_TO_STAGE, application_addedToStageHandler, false, 100);

Thanks!

[EDIT/Fixed: I able to fix the problem after updating to 4.0.0 rc3 (https://github.com/openfl/lime/issues/1331)]