flash on 2014-1-11

by aiz
♥0 | Line 41 | Modified 2014-01-11 23:46:24 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.MovieClip;
    public class Index extends MovieClip{
        public function Index() {
            // write as3 code here..
          var myCircle1:DrawCircle = new DrawCircle();
          var myCircle2:DrawCircle = new DrawCircle();
          myCircle1.x = 50;
          myCircle1.y = 60
          myCircle2.x = 200;
          myCircle2.y = 90;
          addChild(myCircle1);
          addChild(myCircle2);
          // removeChild(myCircle1);
        }
    }
}
import flash.display.MovieClip;
class DrawCircle extends MovieClip{
      public function DrawCircle(){
           var centerX:Number = 100;
           var centerY:Number = 200;
           var r:Number = 50;
           
           graphics.lineStyle(2, 0x00ff00);
           
           graphics.moveTo(centerX+r, centerY);
           
           graphics.curveTo(r+centerX, Math.tan(Math.PI/8)*r+centerY,
                                       Math.sin(Math.PI/4)*r+centerX,
                                       Math.sin(Math.PI/4)*r+centerY);

           graphics.curveTo(Math.tan(Math.PI/8)*r+centerX, r+centerY,centerX,r+centerY);
           
           graphics.curveTo(-Math.tan(Math.PI/8)*r+centerX, r+centerY,
                                       -Math.sin(Math.PI/4)*r+centerX,
                                       Math.sin(Math.PI/4)*r+centerY);

           graphics.curveTo(-r+centerX, Math.tan(Math.PI/8)*r+centerY,-r+centerX,centerY);
           
           graphics.curveTo(-r+centerX, -Math.tan(Math.PI/8)*r+centerY, 
                                       -Math.sin(Math.PI/4)*r+centerX,
                                       -Math.sin(Math.PI/4)*r+centerY);

           graphics.curveTo(-Math.tan(Math.PI/8)*r+centerX, -r+centerY, centerX, -r+centerY);
           
           graphics.curveTo(Math.tan(Math.PI/8)*r+centerX, -r+centerY, 
                                        Math.sin(Math.PI/4)*r+centerX,
                                       -Math.sin(Math.PI/4)*r+centerY);
           graphics.curveTo(r+centerX,-Math.tan(Math.PI/8)*r+centerY, r+centerX, centerY);    

        }
}