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

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

  •  13-07-2023
  •  | 
  •  

質問

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

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top