Vertically Aligning Text



  • I'm making a widget with a FlxBar and FlxText to display the value centered on the FlxBar. How can I calculate the actual text character height so it centers vertically. I'm targeting all platforms.

    I've thought of using this to get the values I need,

    txtValue.textField.getCharBoundaries(0).height;
    txtValue.textField.getCharBoundaries(0).top;
    

    which seems like it might work, but isn't supported on all targets.

    I'd like a solution for as many targets as possible.
    Does anyone know how to do this?


Log in to reply