Battletech Live

Online, Turn-Based Battletech – Development Logs

The evil that is htmlText.

I’ve been working on email all weekend, getting the site set up so that users can send, reply to and forward messages.  I ran into one problem a while back and deciding that it wasn’t worth my effort at the time, put it on hold to work on other things.  I’m back at it again and finding it very frustrating.  When dealing with a Rich Text Editor in Flex, the output of the form can be htmlText.  That text can then be submitted to and stored on the server.

<TEXTFORMAT LEADING=\”2\”><P ALIGN=\”LEFT\”><FONT FACE=\”Myriad Web\” SIZE=\”10\” COLOR=\” 0F0F0F\” LETTERSPACING=\”0\” KERNING=\”0\”>This is a test.</FONT></P></TEXTFORMAT>

The problem is that Actionscript is really craptastic at dealing with htmlText imported from an external source.  Lets say that the above is the output from a php file that Flex then pulls as a Result Event.  This string gets stored either as a string variable or within a cell of an array.  When the time comes to display the text in a TextArea, nothing will display.  However, if it’s entered literally into the source of the page with something like the following, it works perfectly:

mailerRead.htmlText = “<TEXTFORMAT LEADING=\”2\”><P ALIGN=\”LEFT\”><FONT FACE=\”Myriad Web\” SIZE=\”10\” COLOR=\” 0F0F0F\” LETTERSPACING=\”0\” KERNING=\”0\”>This is a test.</FONT></P></TEXTFORMAT>”;

I’ve looked all over for how to get it to work and nothing seems to work.  I’ve almost decided that for now, I’m going to have to set it up to be strictly plain text, then later, take time to build a parser to deal with it and reconfigure it as a string that it can recognize.

Advertisements

April 12, 2009 - Posted by | Project Development

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: