2014-10-06 87 views
-1

在我的应用程序中,我使用将HTML字符串转换为TextFlow在文本区域中显示项目符号列表。它工作正常。但问题是如果列表项使用下划线样式,项目符号将被排除。使用TextConverter.importToFlow删除项目符号列表中的下划线

var htmlStr:String = '<FONT SIZE="13" COLOR="#333333"><UL><LI><FONT COLOR="#ff0000"><B><U>Item 1</U></B></FONT></LI><LI><FONT COLOR="#ff0000"><B><U>Item 2</U></B></FONT></LI></UL></FONT>'; 

textArea.textFlow = TextConverter.importToFlow(htmlStr, TextConverter.TEXT_FIELD_HTML_FORMAT); 

请帮我删除项目符号下的行。我正在使用Flash Builder 4和Flex SDK 4.9.1

回答

0

我找到了这种情况的解决方案。下面我的代码

var htmlStr:String = '<FONT SIZE="13" COLOR="#333333"><UL><LI><FONT COLOR="#ff0000"><B><U>Item 1</U></B></FONT></LI><LI><FONT COLOR="#ff0000"><B><U>Item 2</U></B></FONT></LI></UL></FONT>'; 
var textFlow:TextFlow = TextConverter.importToFlow(htmlStr, TextConverter.TEXT_FIELD_HTML_FORMAT); 
var arr:Array = textFlow.getElementsByTypeName("list"); 

if(arr && arr.length > 0) 
{ 
    for each(var listElement:ListElement in arr) 
    { 
     listElement.listMarkerFormat.textDecoration = TextDecoration.NONE; 
    } 
} 

textArea.textFlow = textFlow;