getTextFormat (TextField.getTextFormat メソッド)

public getTextFormat([beginIndex: Number], [endIndex: Number]) : TextFormat

文字、文字の範囲または TextField オブジェクト全体に対して TextFormat オブジェクトを返します。

使用できるバージョン : ActionScript 1.0、Flash Lite 2.0

パラメータ

beginIndex: Number (オプション) - ストリング内の文字を指定する整数。beginIndex および endIndex を指定しない場合、返される TextFormat オブジェクトの対象は TextField 全体になります。

endIndex: Number (オプション) - テキスト範囲の終了位置を指定する整数。beginIndex を指定して endIndex を指定しない場合、返される TextFormat の対象は beginIndex で指定された 1 つの文字になります。

戻り値

TextFormat - オブジェクト。

次の ActionScript は、実行時に作成されたテキストフィールドの全フォーマット情報を表示します。

this.createTextField("dyn_txt", this.getNextHighestDepth(), 0, 0, 100, 200);
dyn_txt.text = "Frank";
dyn_txt.setTextFormat(new TextFormat());
var my_fmt: TextFormat = dyn_txt.getTextFormat();
for (var prop in my_fmt) {
    trace(prop+": "+my_fmt[prop]);
}

関連項目

getNewTextFormat (TextField.getNewTextFormat メソッド), setNewTextFormat (TextField.setNewTextFormat メソッド), setTextFormat (TextField.setTextFormat メソッド)