Error when using FlxSliceSprite - graphic.imageFrame is null

  • I'm trying to move to using the FlxSliceSprite from the FlxUI9SliceSprite so that I can output to the Windows target. My previous implementation with FlxUI9SliceSprite was working without any issues but when I switched to the FlxSliceSprite I started getting some errors about invalid bitmap data. The error is occurring in FlxSliceSprite at line 345: helperFrame = graphic.imageFrame.frame.subFrameTo(tempRect, helperFrame); At this point graphic.imageFrame is null. I'm having difficulty figuring out why this error is happening. Does anyone have any experience using this class that could help me figure out where I'm going wrong? The way that I'm initializing the class is background = new FlxSliceSprite(AssetPaths.dialogBox__png, new FlxRect(0, 0, 16, 32), 256, 128); but the error doesn't occur until the background is added as a child and tries to render.

  • In case anyone else ever comes across this. My problem was that I was using a static class for my dialog box. When I would change states for some reason the graphics would get cleared and needed to be reassigned.

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.