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: ASCII Mandelbrot

Adapted from JavaScript version by p01
http://www.p01.org/releases/Demoscene/files/mandelbrot_rotozoom_256b_javascript_1.1.htm
Get Adobe Flash player
by hiro_rec 11 Mar 2009
// forked from makc3d's ASCII Mandelbrot
package
{
    import flash.display.*;
    import flash.geom.*;
    import flash.filters.*;
    import flash.text.*;

    [SWF(width = "465", height = "465", backgroundColor = "0x000000", frameRate = "20")] 

    /**
     * Adapted from JavaScript version by p01
     * http://www.p01.org/releases/Demoscene/files/mandelbrot_rotozoom_256b_javascript_1.1.htm
     */
    public class ASCIIMandelbrot extends Sprite
    {
        private var tf:TextField;
        private var cm:Array = 'I<A3wOndeRfL.  '.split ('');
        private var n:Number = 10.0;


        public function ASCIIMandelbrot () {
            tf = new TextField; tf.autoSize = 'left'; tf.multiline = true;
            tf.textColor = 0xFFFFFF; tf.x = -21; tf.y = -33; addChild (tf);

            addEventListener ("enterFrame", enterFrameListener);
        }

        private function enterFrameListener (e:*):void {
            var output:String = '';
	
            // rotation
            n -= 88;
            var C:Number = Math.cos (n);
            var S:Number = Math.sin (n);
            var m:Number = 1 + C;

            // loop
            var zz:int = 2048;
            for (var Y:Number = m; zz; Y -= m/16) {

                output += '<br>';

                for (var X:Number = m; --zz&63; X -= m/32) {

                    var r:Number, i:Number, t:Number, k:int;

                    for (r=i=k=0; ++k+r*r+i*i<13; i=t) {
                        t = 2*r*i - X*C + Y*S; r = r*r - i*i - X*S - Y*C + C-1;
                    }

                    output += cm [k];
                }
            }

            tf.htmlText = '<font face="fixedsys">' + output + '</font></pre>';
        }
    }
}