hellloWorld - TextField()

by funnythingz
************************************************************
HelloWorld - TextField()
とりあえず文字を書き出してみる。
♥0 | Line 23 | Modified 2010-04-23 14:55:38 | MIT License
play

ActionScript3 source code

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

//************************************************************
// HelloWorld - TextField()
// とりあえず文字を書き出してみる。
//
package {
    import flash.display.*;
    import flash.text.*;
    public class Main extends Sprite {
        //------------------------------------------------------------
        // Mainコンストラクタ
        //
        public function Main() {
			
			//h1 TextFormat() を定義
			var tf_h1:TextFormat = new TextFormat();
			tf_h1.color = 0x666666;
			tf_h1.size = 30;
			tf_h1.font = 'Times New Roman';
			tf_h1.align = TextFieldAutoSize.CENTER;
			
			//titleを定義
			var title:TextField = new TextField();
			title.text = 'HelloWorld!! - TextField()';
			title.width = stage.stageWidth;
			title.height = 40;
			title.x = 0;
			title.y = (stage.stageHeight/2);
			title.setTextFormat( tf_h1 );
			title.background = true;
			title.backgroundColor = 0xEEEEEE;
			
			//stageに要素を追加
			stage.addChild( title );
        }
    }
}