Skip to main content
Participant
May 11, 2009
Answered

HTML markup

  • May 11, 2009
  • 2 replies
  • 1789 views

Hi,

I am trying to create a textFlow from a HTML formatted string. I do this as follows.

var markup:String = "<b>bold</b><i>italic</i>Mary has a little lamb";

var  textFlow:TextFlow = TextFilter.importToFlow(markup, TextFilter.HTML_FORMAT);   
textFlow.flowComposer.addController(new ContainerController( myTextFlowSprite, width, height));

textFlow.flowComposer.updateAllControllers();

I am expecting the text to be rendered to a single line but instead every tag is being rendered on a new line. The result looks like this

bold

italic

Mary has a little lamb

How can I get the text to render on a single line?

thanks,

Marco

This topic has been closed for replies.
Correct answer Abhi.G.

Marco,

Try using "<p><b>bold</b><i>italic</i>Mary has a little lamb</p>".

It looks like the code that deals with implied elements does not handle some cases correctly: what's happening in your case is that all three of <b>bold</b>, <i>italic</i>, and Mary has a little lamb are getting nested in three separate <p/> elements.

- Abhishek

(Adobe Systems Inc.)

2 replies

Participating Frequently
May 12, 2009

Hi,

How come you able to get TextFilter.Html_Format

I am only getting  TextFilter.TEXT_LAYOUT_FORMAT and TextFilter.PLAIN_TEXT_FORMAT.

Please suggest.

Participating Frequently
May 12, 2009

Amit,

Which build are you using? Support for HTML import/export was added after Beta1 of TLF. Try using one of the later weekly builds.

- Abhishek

(Adobe Systems Inc.)

Participating Frequently
May 12, 2009

Thanks Abhishek,

Got it!

But its not taking HTML <table> and <ul> tags.

Any suggestions how to display html table and bulletted lists using TLF.

Abhi.G.Correct answer
Participating Frequently
May 11, 2009

Marco,

Try using "<p><b>bold</b><i>italic</i>Mary has a little lamb</p>".

It looks like the code that deals with implied elements does not handle some cases correctly: what's happening in your case is that all three of <b>bold</b>, <i>italic</i>, and Mary has a little lamb are getting nested in three separate <p/> elements.

- Abhishek

(Adobe Systems Inc.)

Marco_ChrAuthor
Participant
May 11, 2009

Hi Abhishek,

I have tried adding the paragraph tag like you suggested and it works. All tags are now being rendered to a single line.

thanks :-)

Marco