Windows target bitmap embed issue

Hello. I have a project, which compiles perfectly well for flash.
But when I do so for windows, I get the error “Null Function Pointer” and this log:

Called from
Called from
Called from openfl._v2.display.Bitmap::new::openfl/_v2/display/Bitmap.hx::20
Called from openfl._v2.display.Bitmap::set_smoothing::openfl/_v2/display/Bitmap.hx::75
Called from openfl._v2.display.Bitmap::__rebuild::openfl/_v2/display/Bitmap.hx::40
Called from openfl._v2.display.Graphics::clear::openfl/_v2/display/Graphics.hx::73

Assets.hx::13 is:

@:bitmap("assets/img/all_icons.png") class IconsSheet extends BMP { }

Thats a regular bitmap import, but “windows” doesn’t like it.

How can I fix this? Thanks.

Depending on the target, the stack trace may be in reverse order. The error in this case is actually coming from line 73 of Graphics.hx. Well, actually a line further down, where the function pointer is supposed to be set.

Try making a brand new project and running “graphics.clear().” Does that crash on Windows too?

I’ve just created an empty project and wrote this into Main.added function:

var sprite:Sprite = new Sprite();;;, 0, 50, 50);;

This compiles fine for windows.
So now I’m even more puzzeled.


Why not just use openfl.Assets? That’s been thoroughly tested for all platforms.

…so you use something like this?

var bitmapData = new IconsSheet (0, 0);
var bitmap = new Bitmap (bitmapData);

I have this kind of construction (I started using it since I had errors with bitmap embed even in flash, and you advised me to add that):

class BMP extends Bitmap { public function new() super(); }

@:bitmap("assets/img/all_icons.png") class IconsSheet extends BMP { }
private static var iconsSheet:IconsSheet = new IconsSheet();
//then in some function
newBMD.copyPixels(iconsSheet.bitmapData, rect, new Point());

That works for Flash, but not for Windows.

What happens if you run new BMP()? (Take out the @:bitmap line for this test.)

And what about openfl.Assets? Are you avoiding it because of the “errors with bitmap embed” you mentioned? And if so, do you still get those errors?

The issue might be because it is static, see what happens if you instantiate it locally, I think you may also need to pass 0, 0 into the constructor as well