flash on 2009-11-6

by littlepad
♥0 | Line 22 | Modified 2009-11-06 17:27:00 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.*;
    import flash.text.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var tf:TextField = new TextField();
            var tfmt:TextFormat = new TextFormat();
            tfmt.color = 0x000000;
            tfmt.size = 80;
            tfmt.font = "Century Gothic";
            tf.autoSize = TextFieldAutoSize.LEFT;
            
            tf.defaultTextFormat = tfmt;
            tf.text = "hello world";

            
            var myBitmapData:BitmapData = new BitmapData(tf.textWidth, tf.textHeight);
            myBitmapData.draw(tf);
            var bmp:Bitmap = new Bitmap(myBitmapData);
            bmp.x = (stage.stageWidth - bmp.width) / 2;
            bmp.y = (stage.stageHeight - bmp.height) / 2;
            addChild(bmp);
        }
    }
}