Groups | Blog | Home
all groups > flash actionscript > november 2004 >

flash actionscript : Not seeing formatting with htmlText



radiac
11/4/2004 11:10:28 PM
I am publishing a flash movie for Flash Player 7 and actionscript 2.0 with the
following code:

this.createTextField("txt", 1, 0, 0, 230, 200);
txt.type = "dynamic";
txt.autoSize = "left";
txt.align = "left";
txt.multiLine = true;
txt.wordWrap = true;
txt.html = true;
txt.htmlText="hello<br>test<br>asdf";

I can see the text, however the <br> tags do not cause a linebreak to occur.
I've tested this with other tags that should cause some sort of linebreak
(<li></li> .. <p></p> .. <span> </span>) and all of the text appears on a
single line, regardless.

Any suggestions would be greatly appreciated....
_jrh_
11/4/2004 11:54:55 PM
Try using newline instead:

txt.htmlText = "hello\ntest\nasdf";

radiac
11/5/2004 9:58:22 PM
That worked. However, if I am importing my HTML from a file, new-lines don't
appear to cause a new line in the text field, and "\n" appears as "\n" and not
as a new line.

For example:

item=This
is
a
test

will be displayed as "Thisisatest" in my TextField.

item=This\nis\na\ntest\n

will be displayed as "This\nis\na\ntest\n"

I experimented with including some hex code in my text, to cause a new line,
but haven't figured out the right way yet. Anyone have any ideas?

Also, it seems to me this is a bug. The documentation for Actionscript says
the <br> tag is supported in htmlText. Am I correct? or is this working as
intended?
_jrh_
11/5/2004 11:13:53 PM
Oh, I found the problem. You have a simple syntax error on multiline.

txt.multiline = true; // no capitals

radiac
11/5/2004 11:22:19 PM
_jrh_
11/5/2004 11:59:58 PM
AddThis Social Bookmark Button