flash on 2015-5-8

by asou_jp
♥0 | Line 26 | Modified 2015-05-08 15:43:29 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.geom.Matrix;
    import flash.text.TextField;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            var sprite:Sprite = new Sprite();
            sprite.graphics.beginFill(0, 1);
            sprite.graphics.drawRect(-50,-50,100,100);
            
                
            var mtx : Matrix = new Matrix();
            mtx.identity();
            mtx.rotate(Math.PI / 180 * 80);
            
            
            sprite.transform.matrix = mtx;
            sprite.x = 465 / 2;
            sprite.y = 465 / 2;
            if (sprite.rotation > 45) {
                sprite.rotation = 45;
                }
            
            addChild(sprite);
            
            var tf:TextField = new TextField();
            tf.autoSize = "left";
            tf.text = String(sprite.rotation);
            addChild(tf);
            
        }
    }
}