In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

mogero

Get Adobe Flash player
by keno42 01 Jul 2010
/**
 * Copyright keno42 ( http://wonderfl.net/user/keno42 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/buYH
 */

package {
    import flash.display.Sprite;
     import flash.display.Graphics;
    public class FlashTest extends Sprite {
        private var line_r:Number = 10;
        private var circle_r:Number = 50;
        private var step:Number = Math.PI / 16;
        public function FlashTest() {
            // write as3 code here..
            var sp:Sprite = new Sprite();
            var i:Number;
            addChild(sp);
            sp.x = sp.y = 100;
            var g:Graphics = sp.graphics;
            g.lineStyle(0);
            g.drawCircle(0, 0, circle_r);
            var a:Number = line_r * Math.sqrt(2);
            var b:Number = (circle_r - line_r)/Math.sqrt(2);
            var c:Number = a / 2;
            g.beginFill(0xFF8888);
            g.moveTo(a,0);
            g.lineTo(b+c,b-c);
            draw(g,b,b,line_r,-0.25*Math.PI,0.75*Math.PI,step);
            g.lineTo(0,a);
            g.lineTo(-b+c,b+c);
            draw(g,-b,b,line_r,0.25*Math.PI,1.25*Math.PI,step);
            g.lineTo(-a,0);
            g.lineTo(-b-c,-b+c);
            draw(g,-b,-b,line_r,0.75*Math.PI,1.75*Math.PI,step);
            g.lineTo(0,-a);
            g.lineTo(b-c,-b-c);
            draw(g,b,-b,line_r,1.25*Math.PI,2.25*Math.PI,step);
            g.lineTo(a,0);
        }
        private function draw(g:Graphics,x:Number,y:Number,r:Number,s:Number,e:Number,step:Number):void{
            for( var i:Number = s; i <= e; i += step ){
                g.lineTo(x+r*Math.cos(i),y+r*Math.sin(i));
            }
        }
    }
}