2

XMLからテキストを取得するテキストフィールドがあります。選択したテキストのフォント サイズを変更する機能を追加しました。テキストを再度読み込むまで問題なく動作します。次に、最初のサイズ以外のすべてのサイズを無視します。

これは、tekst の html テキストです。

<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="PresentationOnline_text" SIZE="63" COLOR="#FF9999" LETTERSPACING="0" KERNING="0">a<FONT SIZE="33">b</FONT></FONT></P></TEXTFORMAT>

And I just set txtText.htmlText to that. Is it not possible to have several font sizes in one textfield?

When I change the size I do this:

textFormat = txtText.getTextFormat(start, end);
textFormat.size = Number(textFormat.size) - 1;
txtText.setTextFormat(textFormat, start, end);

Anything I'm missing?

Thanks!

Edit:

Works when I do it in this order:

txtText.defaultTextFormat = textFormat;
txtText.setTextFormat(textFormat);
txtText.htmlText = text;

But I know I did it the other way around for some good reason I can't remeber..

4

1 に答える 1

1

選択したテキストのフォント サイズを変更する機能を追加しました。テキストを再度読み込むまで問題なく動作します。

setTextFormat()既存のテキストのフォーマットに影響します。setTextFormat()手動または を使用して適用された後に挿入されたテキストreplaceSelectedText()は、テキストフィールドのデフォルトのテキスト形式でフォーマットされます。

テキストフィールドのデフォルトのテキスト形式を設定するにdefaultTextFormatは、読み取り/書き込み可能なプロパティを使用する必要があります。

この情報は役に立ちますか?

于 2010-11-24T17:28:23.913 に答える