flash on 2010-11-27

by 3f5
♥0 | Line 36 | Modified 2010-11-27 18:37:36 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.MovieClip;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.events.Event;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.display.Sprite;
    import flash.text.TextFormat;

    public class FlashTest extends Sprite {
        public var mc:MovieClip;

        public function FlashTest() {
            var format:TextFormat = new TextFormat();
                
            format.font = 'メイリオ';
            format.align = 'center';
            format.size = 80;
            
            var text:TextField = new TextField();
            
            text.text = 'てすと';
            text.setTextFormat(format);
            text.defaultTextFormat = format;
            text.autoSize = TextFieldAutoSize.CENTER;
            text.x = (stage.stageWidth - text.width) / 2;
            text.y = (stage.stageHeight - text.height) / 2;
            
            mc = new MovieClip();
            
            mc.rotation = 50;
            
            mc.addChild(text);
            stage.addChild(mc);
            
            var timer:Timer = new Timer(50, 0);

            timer.addEventListener(TimerEvent.TIMER, spin);
            timer.start();
        }
        
        private function spin(e:Event):void {
            mc.rotation = mc.rotation + 1;
        }

    }
}