By default FlxText
object is autosized - its height and width
are determined by its text content. You can control this behavior with such properties
as fieldWidth
, fieldHeight
and autoSize
. Note: updating these properties triggers updating field’s hitbox!
// fixed width and height
text.fieldWidth = 100;
text.fieldHeight = 50;
// fixed width but auto height
text.fieldWidth = 100;
text.fieldHeight = -1;
If you want to make an autosized text explicitly:
text.autoSize = true;
text.wordWrap = false; // must be explicitly set to `false`
// or
text.fieldWidth = text.fieldHeight = -1;