I am writing a small game in OpenFL (after migrating from AS3) and I stumbled upon a possible problem with the TextField.
I have a text that contains ‘\n’ characters. Using this code, I set that text to my TextField:
this.textFormat = new TextFormat(Assets.getFont("fonts/arial.ttf").fontName); this.textFormat.size = 20; this.textFormat.color = 0xffffff; this.textFormat.align = TextFormatAlign.LEFT; textField = new TextField(); textField.multiline = true; textField.wordWrap = true; textField.antiAliasType = AntiAliasType.ADVANCED; textField.autoSize = TextFieldAutoSize.LEFT; textField.embedFonts = true; textField.selectable = false; textField.text = displayText; textField.width = layout.storyTextFieldWidth() + 5; textField.height = textField.textHeight; textField.x = layout.storyTextFieldPozition().x; textField.setTextFormat(this.textFormat);
The problem is, that after the first ‘\n’ character, no text is displayed. The height however is set correctly, just like there was text there.
I tried compiling both for HTML and for Windows (with -neko), but the problem persists. Am I doing something wrong or is there a problem in the implementation of the TextField?
UPDATE: I tried using htmlText. Using < br > I get the same result (nothing displayed after < br >). Also, using any tags (i, b, etc.) causes no text to be displayed at all.