Issues importing a Bitmap - 404 png not found?

Greetings everyone,

Thanks for taking a look at my issue. I’m using HaxeDevelop to load a bitmap image in and publish out to HTML5. However, in doing so I’m getting the following error:

Uncaught [lime.utils.Assets] ERROR: There is no IMAGE asset with an ID of "assets/wallpaper.png"

Edit: Originally it had a 404 error stating that the png file could not be found, but since I stripped everything else out of my project, the above error shows instead.

Now, I’ve used code directly out of the DisplayingABitmap sample file (which works perfectly). However when I try it doesn’t work. I even removed everything in my code except for the following…

package;

import openfl.Assets;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Sprite;

class Main extends Sprite {

public function new () {
	
	super ();
	
	var bitmap = new Bitmap (Assets.getBitmapData ("assets/wallpaper.png"));
	addChild (bitmap);
	
}

}

My folder directory looks like this:

  • References
  • Assets
    • wallpaper.png is in this folder
  • Export
  • Source
    • Main.hx is in this folder
  • project.xml

I’m wondering if my HaxeDevelop isn’t setup correctly. My project folder is in a different directory than the Haxelib install I initially downloaded and I’ve noticed that when I tried using import motion.Actuate; it didn’t recognize it for me, where as an animation example I was reviewing did work. The only difference I could see is it’s location on my computer.

Thanks for taking a look at my issue,
Greg

You’ve probably missing something within project.xml file. For asset defined like you’ve shown you should have a project.xml file entry like the following:

<assets path="Assets" rename="assets" />
1 Like

Thank you. That did it. I’m still learning things like this. The documentation doesn’t always cover these details when setting up files.

Thanks again.

No problem. Glad you’ve got things working now :slight_smile: never hesitate to ask :slight_smile: