forked from: flash on 2010-8-26

by hidebo
文字列の表示
♥0 | Line 21 | Modified 2010-08-30 17:58:13 | MIT License
play

ActionScript3 source code

/**
 * Copyright hidebo ( http://wonderfl.net/user/hidebo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bIK1
 */

package {
    import flash.display.*;
    import flash.text.*;
    
    //文字列の表示
    [SWF(width=240, height=240, backgroundColor=0xFFFFFF)]
    public class StringEx extends Sprite {
        //コンストラクタ
        public function StringEx(){
            //ラベルの生成
            var label:TextField = new TextField();            
            label.text       = "hello World!";        //テキスト                  
            label.x          = 10;                      //X座標
            label.y          = 10;                      //Y座標
            label.autoSize   = TextFieldAutoSize.LEFT;//オートサイズ            
            label.selectable = false;                  //選択不可
            
            //書式の指定
            var format:TextFormat = new TextFormat();            
            format.color = 0xFF0000;//            
            format.font  = "_等幅";    //フォント    
            format.size  = 24;         //文字サイズ    
            label.setTextFormat(format);
            
            //ラベルの追加
            addChild(label);
        }
    }
}