开发者

Text Flow to HTML

I receive a String which is passed on through a flex applica开发者_Go百科tion and has text flow format as follows:

<?xml version='1.0' encoding='utf-8'?>
<TextFlow fontFamily='Arial' fontSize='16' paddingBottom='2' paddingLeft='2'
          paddingRight='2' paddingTop='2' whiteSpaceCollapse='preserve'
          version='2.0.0' xmlns='http://ns.adobe.com/textLayout/2008'>
  <p>
    <span>Word1</span>
    <span fontWeight='bold'>Word2</span>
    <span fontSize='22' fontWeight='bold'>Word 3</span>
    <span baselineShift='superscript' fontSize='22'
          fontWeight='normal'>Word4superscript</span>
  </p>
</TextFlow>

How can i convert this to HTML that i can use this in my java application keeping all the font sizes and color span?


You can use the TextConverter class to transform TextFlow into an html string.

import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.conversion.ConversionType;

var output:Object = TextConverter.export(textFlow,TextConverter.TEXT_FIELD_HTML_FORMAT, ConversionType.STRING_TYPE)

Where textFlow is the it the variable containing your TextFlow object.

More information detailing importing and exporting with TextFlow can be found here:

http://flex4fun.com/2010/11/30/flex4-export-textflow-data/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜