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

forked from: flash on 2012-11-11

Get Adobe Flash player
by tkinjo 11 Nov 2012
    Embed
/**
 * Copyright tkinjo ( http://wonderfl.net/user/tkinjo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/A7Ha
 */

// forked from son's flash on 2012-11-11
package {
    import flash.display.Graphics;
    import flash.display.Sprite;
    [SWF(width="500", height="500", frameRate="60")]
    
    public class FlashTest extends Sprite {
        
        private const Z0:int = 500;
        
        public function FlashTest() {
            // write as3 code here..
            
            var canvas:Sprite = new Sprite();
            canvas.y = stage.stageHeight/2;
            canvas.x = stage.stageWidth/10 + stage.stageWidth / 2;
            
            var canvasGraphics:Graphics = canvas.graphics;
            
            canvasGraphics.lineStyle(1);
            //canvasGraphics.moveTo(0, 0);
            
            //canvasGraphics.drawCircle(canvas.x, canvas.y/2, 100);
            
            for(var i:Number = 0; i < 520; i += 10) {
                canvasGraphics.moveTo(i, j);
                for (var j:Number = 0; j < 520; j += 10) {
                    canvasGraphics.drawCircle(reGamma(i, j)*200, imGamma(i, j)*200, 1);
                    //canvasGraphics.lineTo(canvas.x + reGamma(i, 0), canvas.y + imGamma(i, 0));    
                }
            }
            
            addChild(canvas);

        }
        
        private function reGamma(R:Number, X:Number):Number {
            R = R*10;
            X = X*10;
            var gamma:Number = (R*R - Z0*Z0 + X*X)/((R + Z0)*(R + Z0) + X*X);
            return gamma;
        }
        
        private function imGamma(R:Number, X:Number):Number {
            R = R*10;
            X = X*10;
            var gamma:Number = (2*X*Z0)/((R + Z0)*(R + Z0) + X*X);
            return gamma;
        }


    }
}