にテキストを配置するとうまく機能するスクリプトがありますが、Dynamic Text
これを外部.txt
ファイルからロードすると、ロードしたテキストは動的テキストに挿入されません。
これが私のコードです:
私の外部txtファイルでは、これを使用します:
_txt=Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
これを使用して、外部テキストを読み込みます。
loadText = new LoadVars();
loadText.load("letreiro.txt");
loadText.onLoad = function() {
_root.textoletreiro = this._txt;
trace(_root.textoletreiro); // the Output shows the text!
mcText._txt.text = _root.textoletreiro; // here i'm puting the text on the Dynamic Text, but is not working.
};
そして、ここに私の水平スクロールコード:
var resetPos:Number = (mcText._txt._x * -1) + 2;
var endOfText= mcText._txt._x - (mcText._txt.textWidth + 5);
function scroller()
{
mcText._txt._width = mcText._txt.textWidth;
mcText._txt.multiline = false;
mcText._txt.autoSize = "right";
mcText.onEnterFrame = function() {
mcText._txt._x -= 1;
if (mcText._txt._x < endOfText)
{
mcText._txt._x = resetPos;
delete this["onEnterFrame"];
scroller();
}
}
}
scroller();
私は何を間違っていますか?
PS:私のソースで編集letreiro.txt