FlxButton - How to draw the button graphic with code

  • Rather than use a FlxGraphicAsset for my buttons, I'd like to draw the button graphic myself. I've tried makeGraphic() and then use FlxSpriteUtil to draw on it, but I don't know how to make the 3 frames needed for the button. I've also tried drawing directly on the button. Is there a way to do this? I've searched but nothing is coming up.

  • I assume you have drawn 3 frames on the button. You now need to loadGraphic() of the button itself

    button.loadGraphic(button.graphic.bitmap, true, buttonFrameWidth, buttonFrameHeight);

  • @DleanJeans

    That's what I needed. Thank you very much.

Log in to reply