TextFieldの練習です。(その1)

by plus-tic
wonderfl本で練習中
♥0 | Line 23 | Modified 2010-08-12 02:27:24 | MIT License
play

ActionScript3 source code

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

//wonderfl本で練習中
package {
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFieldAutoSize;
    import flash.display.Sprite;
    public class MyTextField extends Sprite {
        public function MyTextField() {
            //テキストの書式
            var tf:TextFormat = new TextFormat();
            tf.font = "_typewriter";
            tf.size = 18;
            tf.color = 0x0000ff;
            //テキストフィールドの作成
            var fld:TextField = new TextField();
            fld.x = 100;
            fld.y = 100;
            fld.autoSize = TextFieldAutoSize.LEFT;
            fld.background = true;
            fld.backgroundColor = 0xffff00;
            //テキストを設定するよりも前に書式を設定すること
            fld.defaultTextFormat = tf;
            fld.text = "無理を通して道理を蹴飛ばす";
            addChild(fld);
        }
    }
}