newline characters (\n \r) not being respected with OpenFL flash.text.TextField on JS target

StackOverflow https://stackoverflow.com/questions/23401536

  •  13-07-2023
  •  | 
  •  

Question

If I create a flash.text.TextField using OpenFL for a JS target, none of my newline characters are showing up. The textfield instead has one long string on a single line.

I've tried changing .wordWrap and .multiline but they do nothing to change this behavior.

haxe 3.1.3 openfl-html5 1.4.2

Was it helpful?

Solution

Here is the file respoinsible for this behaviour. There is no handling of multiline property implemented currently, and no "\n" handling also. So your only options would be to either transform the texts yourself, or implement that handling(and probably file a pull request to also help others).

Talking about "\r", I don't think it would or even should be implemented, because runtime system isn't the place to handle incorrect encodings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top