2011-08-29 9 views
2

画像をflex3でTLFに挿入すると、TLFの画像が正方形の領域に表示されていました。画像の上部にはスペースがあります。この問題については、添付イメージを参照してください。このスペースを削除する方法Flex3を使用したTLFの画像の上部に余分なスペースがあります

too much space at the top of image in TLF in Flex3

?私は次の方法を試してみるが、うまくいかない!

var graphic_element:InlineGraphicElement = IEditManager(activeFlow.interactionManager).insertInlineGraphic(foreignElementUrl, width, height, "none"); 

graphic_element.paddingTop = 0; 
graphic_element.paddingBottom = 0; 
graphic_element.paddingRight = 0; 
graphic_element.paddingLeft = 0; 
IEditManager(activeFlow.interactionManager).applyParagraphFormat(graphic_element); 

答えて

1

これは多分ですか?

inlineGraphicElement.textDecoration = null; 
inlineGraphicElement.alignmentBaseline = TextBaseline.ASCENT; 
inlineGraphicElement.lineHeight = "100%"; 
+0

ありがとう、最後のステートメントはキーです。 – zhongshu

0

次のコードは、HTMLソースからtextFlowを作成する場合に便利です。これは、ディスプレイ内のテキストフロー内のすべての画像を修正します。

static private function _InlineGraphicElementCorrection(children:Array):void 
{ 
    var numChildren:int = children.length; 
    for (var i:int=0; i<numChildren; i++) 
    { 
     if(children[i].hasOwnProperty('mxmlChildren')) 
      _InlineGraphicElementCorrection(children[i].mxmlChildren); 
     if(!(children[i] is InlineGraphicElement)) 
      continue; 

     var graphicElement : InlineGraphicElement = children[i]; 
     graphicElement.textDecoration = null; 
     graphicElement.alignmentBaseline = TextBaseline.ASCENT; 
     graphicElement.lineHeight = "100%"; 
    } 
} 

static public function importHtmlToFlow(html:String):TextFlow 
{ 
    var flow : TextFlow = TextConverter.importToFlow(html.replace(/[\r\n]/ig, ""), TextConverter.TEXT_FIELD_HTML_FORMAT); 
    _InlineGraphicElementCorrection(flow.mxmlChildren); 
    return flow 
} 
関連する問題