Skip to main content
December 9, 2009
Question

HTML text importing problem

  • December 9, 2009
  • 1 reply
  • 499 views

HI all,

I want to display a html text. All we need is the bullet function and the line break. Unfortunately I just cannot display any html text properly.

The string comes from an XML basically, but I tried without the xml thing as well.

var _text:String = "<html><body><span>first line of text, <i>this is italic</i> and <a href='cnn.com'>a link to cnn</a>, 2nd line of text.</span></body></html>";

_flow = TextConverter.importToFlow( _text, TextConverter.HTML_FORMAT);

_flow.fontLookup = FontLookup.DEVICE;
_flow.renderingMode = RenderingMode.NORMAL;

_flow.fontFamily = "Arial";

Result: It shows all the tags

I tried also:

_flow = TextConverter.importToFlow( _text, TextConverter.HTML_FORMAT, ConversionType.XML_TYPE as IConfiguration);

or

_flow = TextConverter.importToFlow( _text, TextConverter.HTML_FORMAT, ConversionType.STRING_TYPE as IConfiguration);

but dont help.

Any ideas?

In addition, I tried with nightly builds, but the HTML_FORMAT disappeard from the list of options.

Thanks!

This topic has been closed for replies.

1 reply

Adobe Employee
December 9, 2009

The HTML_FORMAT was renamed to TEXT_FIELD_HTML_FORMAT to reflect the fact that it is specific to the htmlText property in TextField, not a general html implementation.


This is working correctly for me:

            var _text:String = "<html><body><span>first line of text, <i>this is italic</i> and <a href='cnn.com'>a link to cnn</a>, 2nd line of text.</span></body></html>";
           
            var _flow:TextFlow = TextConverter.importToFlow( _text, TextConverter.TEXT_FIELD_HTML_FORMAT);
           
            _flow.fontLookup = FontLookup.DEVICE;
            _flow.renderingMode = RenderingMode.NORMAL;
           
            _flow.fontFamily = "Arial";
           
            var s:Sprite = new Sprite();
            s.x = 30;
            s.y = 30;
            _flow.flowComposer.addController(new ContainerController(s, 300, 500));
            _flow.flowComposer.updateAllControllers();
            addChild(s);

December 10, 2009

Thanks!

I had to download the nightly build SDK and now it works with that sample html code.