flash on 2015-6-12

by komatsu
♥0 | Line 20 | Modified 2015-06-12 09:29:33 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here
            
            var tf:TextField = new TextField();
            tf.text = "Hello world!!";
            tf.width = 400;//<--------------------------------------
            tf.x = (stage.stageWidth - tf.width)/2;
            tf.y = (stage.stageHeight - tf.height)/2;
            
            addChild(tf);
            
            var tformat:TextFormat = new TextFormat();
            tformat.size = 50;
            tformat.color = 0xff0000;
            tformat.align = "center";//<--------------------------------------
            
            tf.setTextFormat(tformat);
            
        }
    }
}