Flash Ignores HTML Tags!

UPDATE: When you use the setting "multiline" you should never capitalize the "L" in that word. Too bad that neither the Flash IDE Compiler nor MTASC barks at me about this. Live and learn, people!

Normally I don't have a lot of problems with Flash. But when the LiveDocs say that the "<p>" tag works in Flash, then it should work, right?

Well, I am in a situation with some Flash code that makes no sense to me. I have some simple code that puts text into a Label (using createLabel() so that it makes a TextField) but I can't seem to load HTML into it. The "<p>" and "<br>" (and "<br />") tags are being ignored, or skipped. I am very confused.

To prove myself wrong I ceated a very simple piece of code to go into frame one of an FLA timeline and sent it to JesterXL for another diagnosis:

createTextField("leif_lbl", 3, 0, 0, 100, 100);
leif_lbl.html = true;
leif_lbl.multiLine = true;
leif_lbl.wordWrap = true;
leif_lbl.border = true;
leif_lbl.htmlText = "<P>Hello.</P><P>My name is Leif.</P><P>Why don't you say hello?</P>";
trace("leif: " + leif_lbl);
trace(" text: " + leif_lbl.htmlText);

His response: " Um... ok, that's f'd up. I'm seeing the same thing you are on my Mac."

So, in all my Model-View-Control patterned, ARP frameworked, Eclipse environment I must have forgotten something about the TextField object that makes something like this work.

The following code will output this:

leif: _level0.leif_lbl
text: <P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="12" COLOR="#000000">Hello.My name is Leif.Why don&apos;t you say hello?</FONT></P>

Please note that the paragraph tags have been completely removed from the string and the string is butted together. That makes no sense to me at all.

Someone, anyone out there — what the heck is going on?

Comments (6) | Print | Send | del.icio.us | Digg It! | Linking Blogs
3732 Views

Comments

Jason Fincanon's Gravatar change this line:
leif_lbl.multiLine = true;

to:
leif_lbl.multiline = true;
# Posted By Jason Fincanon | 12/6/06 3:55 PM
Leif's Gravatar DOH!

Thanks, Jason. That looks like the very problem!
# Posted By Leif | 12/6/06 4:02 PM
Jason Fincanon's Gravatar No problem. I hate it when I miss little stuff like that because those are the ones that will drive you crazy to no end.
# Posted By Jason Fincanon | 12/6/06 4:03 PM
Algis's Gravatar That's not a surprise - AS 2.0 uses case sensitivity.
# Posted By Algis | 12/6/06 5:33 PM
JesterXL's Gravatar "Hey honey... look, it's code on a timeline!"

"OMG! How CUTE!!!"

"Yeah... I wanna pet it, think it'll bite?"

*MEGA-CHOMP*
# Posted By JesterXL | 12/6/06 5:34 PM
irfan's Gravatar Hi Leif,

The <p> tag is not supported by flash. Instead to achieve the same result use 2 <br> tags and your problem of <p> tag should be resolved.
# Posted By irfan | 12/6/06 9:17 PM