Ignacio Bustos
Ignacio Bustos

Reputation: 3

HaxeFlixel, loadGraphic() for a Bitmap

I have problems triying to set a Bitmap in the method loadGraphic() of the SpriteSheet.

var bd:BitmapData = Assets.getBitmapData("images/MenuDoorTopV1.0_640x260.png");
var b:Bitmap = new Bitmap(bd);

_CompuertaTop = new FlxSprite(-1000, -1000);
_CompuertaTop.loadGraphic(b, false, 0, 0);

Upvotes: 0

Views: 768

Answers (1)

Gama11
Gama11

Reputation: 34138

You need to pass the actual BitmapData instance to loadGraphic().

Also, there's no need to use Assets.getBitmapData() in this case, loadGraphic() does that call for you if you pass the String path:

_CompuertaTop.loadGraphic("images/MenuDoorTopV1.0_640x260.png", false, 0, 0);

Upvotes: 1

Related Questions