Iam trying to make something like a message box , but my problem is that I cant make the text be in multiple lines , only in one line , and its a long text so it goes after the window very much , so I want either make the window resize according to text or vise versa ( text starts another line when it reaches the end of the window would be better ) . I hope I could explain my problem well but Iam on a real rush .
Aligning text according to width
text.wordWrap = true;
text.width = 200;
text.text = "Really long string, long string, yes it's a very long string.";
You have to set a static width of your Text
and set wordWrap
to true
. It now will wrap after the text has reached the width of 200px and continue on the next line.
var text:Text = new Text("My text");
text.wordWrap = true;
Does that not work?
Looks like wordWrap is a static property to be used for newly created Text objects. This should work:
text.setTextProperty("wordWrap", true);
Interesting. I must be using an outdated version of FP, because I can access wordWrap
directly from text objects. Gotta update one of these days.
Having it static feels very strange to me. I guess it would have caused a name collision otherwise, and setTextProperty()
technically satisfies that need.
setTextProperty kinda worked , it did the wordwrap but not according to the width and height which didnt made it fit very well , the weird thing is although I had FP 1.7.2 I had to re-download it because that method didnt exist , and that`s the second time I had to redownload the same version for some missing code .