FlxTextAlign.CENTER doesn't align properly.

  • Hello.

    I've been attempting to resize some of my UI buttons, and expand the text. My aim is to get the text to be fully in the middle, in both the X and Y coordinates of the button.

    However, while FlxTextAlign.CENTER does do the X coordinate right, it seems to place the text at the very bottom of the button, almost to the point of where some letters, such as 'y' and 'j', hang off the button.

    Am I not using the right alignment?

  • @vulpicula

    For FlxUIButton


    For FlxButton you can use labelOffsets

    var btn = new FlxButton(50, 50, "Test");
    btn.setGraphicSize(120, 45);
    var labelY = (btn.height - btn.label.height) / 2;
    btn.labelOffsets = [FlxPoint.get(0, labelY), FlxPoint.get(0, labelY), FlxPoint.get(0, labelY + 1)];

  • All I needed was FlxUIButton, so that's perfect, thank you. ^^

Log in to reply

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