What is the best way to display HTML in Flex?
I have HTML that includes symbols such as the Trademark "TM" as superscript (™). In normal HTML, I would use "™" or ™ to display the Trademark TM. However, I can find no way to import HTML like this into Flex and have it displayed correctly. I am having similar issues with the <li> tag.
<p>This information is intellectual property of My Company™.</p> <p>Available features:</p> <li>Feature 1</li> <li>Feature 2</li> <li>Feature 3</li> <li>Feature 4</li> <p>COPYRIGHT INFORMATION:</p> <p>Copyright © 2008, My Company. All rights reserved.</p>
The only way that I've gotten this to work is by copying and pasting the content directly into Flex:
<mx:Text width="100%" height="100%"> <mx:htmlText> <![CDATA[ This information is intellectual property of My Company™. Available features: • Feature 1 • Feature 2 • Feature 3 • Feature 4 COPYRIGHT INFORMATION: Copyright © 2008, My Company. All rights reserved. ]]> </mx:htmlText> </mx:Text>
I want to use an external HTML file that I can import into my Flex App at run time, so that I don't have to recompile the app for a simple content change.
I've heard of too many issues with the iFrame option, so I want to avoid that, if possible.
Does anyone have any other good suggestions for dealing with this issue?
Okay, this is a tricky one. I just finished a project where we used this open-source library to display HTML: http://code.google.com/p/flex-htmlfilter
It handles lists, tables, etc, and is pretty easy to work with. But, I don't think it supports the trademark symbol. It does support some of the others, though.
I'm using it to pull content from a CMS and display in my flash movie. It has worked great, and allows me all the flash styling flexibility I need.
I don't know if this is a good solution for all problems, but if you want to use a RichText control you can load FlowText in to it which allows you to use more HTML, including superscript and other glyphs, like the ones you want to use.