2

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

Gama11
  • 24,825
  • 7
  • 56
  • 81
sebshady
  • 131
  • 6

1 Answers1

3

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.

larsiusprime
  • 935
  • 6
  • 14
  • You were right, the problem was with the 2 points that define the slice grid. Thank you very much for your quick response! – sebshady Mar 22 '15 at 19:39
  • Glad to be of service! You can find me on github under this same user name if you ever need to directly file an issue about the library. – larsiusprime Mar 22 '15 at 19:55