的TextFormat不会做任何事情会做、事情、TextFormat

由网友(舊人涼心)分享简介:我的code是正确的,但无论如何,反正我的TextFormat不工作,检查后续code。没有看到我做错了什么。my code is correct, but anyhow, anyway my textformat does not work, examine follow code.Didnt see what...

我的code是正确的,但无论如何,反正我的TextFormat不工作,检查后续code。 没有看到我做错了什么。

my code is correct, but anyhow, anyway my textformat does not work, examine follow code. Didnt see what i did wrong.

    //SCROLLING SPEED
var scrolling_speed:int = 2;
//TEXT TO SCROLL

var url:String = "tekst.txt";
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler);
loadit.load(new URLRequest(url));

var my_text:TextField = new TextField();
addChild(my_text);

function completeHandler(event:Event):void
{
    my_text.text = event.target.data as String;
}

//set a format
var format:TextFormat = new TextFormat();
//set the color to the hex
//set the font size
format.size = 24;
format.align = "center";
//apply formatting
my_text.setTextFormat(format);

my_text.x = stage.stageWidth = 50, 0;
//set y coord in middle of stage (about)
my_text.y = stage.stageHeight;
//not selectable
my_text.selectable = false;
//no border
my_text.border = false;
my_text.multiline = true;

my_text.textColor = 0xFFFFFF;
//field scales with more text
my_text.autoSize = TextFieldAutoSize.LEFT;



//add the listener to scroll;
my_text.addEventListener(Event.ENTER_FRAME,move_text);

//scroll function;
function move_text(myevent:Event):void
{
    my_text.y -=  scrolling_speed;
    if (my_text.y<(0-my_text.height))
    {
        my_text.y = stage.stageHeight;
    }
}

对于谁不知道

的字体大小保持小或相同。 而对齐不起作用。 任何帮助将是完美的事情,

The fontsize stays little or the same. and the align doesn't work. Any help would be wonderfull

推荐答案

而不是 my_text.setTextFormat(格式); ,试试 my_text.defaultTextFormat =格式;

阅读全文

相关推荐

最新文章