MovieClips 内に多数の TextFields を含むライブラリがあります。実行時に、これらのいずれかのインスタンスを作成し、そのインスタンスに対して getTextFormat を実行してフォーマットを取得します。次に、コード内に多数の TextField を作成し、それらに対して setTextFormat を実行して同じフォーマットを設定します。
同じことをしようとしていますが、TLFTextFields を使用しています。私は次のものを持っています:
var text:TLFTextField = new classFromLib();
text.selectable = true; //required for getTextFormat to work, flash bug
textFormat = text.getTextFormat();
text.selectable = false; // set it back to false
問題は、textFormat.leading が -2147483648 であり、textFormat.letterSpacing が NaN であることです。これにより、text.setTextFormat(textFormat) を実行すると、それぞれ次の 2 つのランタイム エラーが発生します。
Property lineHeight value -2147483648 is out of range
Property trackingRight value NaN is out of range
setTextFormat を実行する前に textFormat.leading と textFormat.letterSpacing を null に設定すると、すべてが機能しますが、明らかに、テキスト フィールドはライブラリ内の行頭と文字間隔を取得しません。これらの 2 つのプロパティが必要なため、これは問題です。誰でもこれを回避する方法を知っていますか?