Reputation: 141
I am creating a game in HaxeFlixel, using flixel-ui to deal with the user interface. I have run into a problem using the FlxUI9SliceSprite
. I have the following line of code to construct it:
_bg = new FlxUI9SliceSprite(0, 0, "assets/images/panel_bg.png", new Rectangle(0, 0, 280, 50), [8, 8, 16, 16]);
However, this does not work. I believe the problem is with the Graphic
parameter "assets/images/panel_bg.png"
, as using null
(which causes it to use a default graphic) works just fine.
When putting a try-catch around it, I got the following error message:
ArgumentError: Error #2015
Upvotes: 2
Views: 128
Reputation: 935
I'm the maintainer of the flixel-UI library. The error you're experiencing is "Invalid Bitmap Data", which could be caused by any number of things. There's two possibilities that come to mind:
1) Your asset path is wrong, or your asset isn't being found for some reason.
2) Your asset is being loaded, but the 9-slice rules you're submitting result in it doing an "illegal" transformation that results in pieces of it being invalid Bitmap Data (like, say, a section where the math works out that the width or height of the piece is 0 or negative)
Number 1 is unlikely as that would probably just default to a null bitmap and it would just fall back to the default asset.
The easiest way to resolve this is if you could post a sample of the image asset you're using and link to it, then I could inspect what the 9-slice logic you supplied would do to it and narrow down your issue.
Upvotes: 3