Another approach you might try is using StyleableTextField, which I use a lot 
in mobile apps for rendering html:

var textField:StyleableTextField = new StyleableTextField();
var styles:String = "p { leading: 2px; }"; // add all the css you need here
var styleSheet:StyleSheet = new StyleSheet();
styleSheet.parseCSS(styles);
textField.styleSheet = styleSheet;
textField.styleName = this; // inherit other styles from parent
textField.lineBreak = LineBreak.TO_FIT; // implicitly sets wordWrap to true
textField.percentWidth = 100;
textField.htmlText = yourHtml;
this.addElement(textField); // assumes this is a container like HGroup

Don't believe some posts that say you can't add StyleableTextField to 
containers, yes you can. And it's lighter weight than RichText which is not 
recommended for mobile apps anyway. Of course the renderer only supports a 
subset of html, but your example seems pretty simple and should work fine.


Reply via email to