2

flex3のTLFに画像を挿入すると、TLFの画像が正方形の領域に表示されていることがわかりました。そのため、画像の上部にスペースがあります。この問題については、添付の画像を参照してください。

Flex3のTLFの画像上部のスペースが多すぎます

このスペースを削除するにはどうすればよいですか?次の方法を試してみましたが、うまくいきません!

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);
4

2 に答える 2

1

多分これ?

inlineGraphicElement.textDecoration = null;
inlineGraphicElement.alignmentBaseline = TextBaseline.ASCENT;
inlineGraphicElement.lineHeight = "100%";
于 2011-10-13T09:21:09.470 に答える
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
}
于 2013-09-18T13:57:40.000 に答える