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: code on 2009-1-13

Get Adobe Flash player
by ll_koba_ll 13 Jan 2009
package
{

    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.system.*;
    import flash.text.*;
    import flash.geom.*;
    import frocessing.color.*;
    
    [SWF(frameRate="30", backgroundColor="#000000")]
    public class LineSketch01 extends Sprite
    {
        private var logoURL:String = "http://labs.un-q.net/wonderfl/images/pic.jpg"
        private var proxyURL:String = "http://5ivestar.org/proxy/";
        private var proxyCrossdomainURL:String = "http://5ivestar.org/proxy/crossdomain.xml";
        private var loader:Loader;
        private var _txt:TextField;
        
        public function LineSketch01()
        {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event):void
        {
            stage.align = StageAlign.TOP_LEFT;
            stage.quality = StageQuality.HIGH;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            _txt = new TextField();
            _txt.autoSize = TextFieldAutoSize.LEFT;
            var _tf:TextFormat = new TextFormat();
            _tf.font = "_ゴシック";
            _tf.size = 14;
            _tf.color = 0xFFFFFF;
            _txt.defaultTextFormat = _tf;
            _txt.appendText("画像読み込み中...");
            addChild(_txt);

            Security.loadPolicyFile(proxyCrossdomainURL);
            loader = new Loader();
            
            loader.load(new URLRequest(proxyURL+logoURL));
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
        }

        private function loadCompleteHandler(e:Event):void
        {
            removeChild(_txt);

            var bmpd:BitmapData = new BitmapData(loader.width*2,
                                                 loader.height*2,
                                                 false,
                                                 0xFFFFFF);
            var mtx:Matrix = new Matrix();
            mtx.scale(2,2);
            bmpd.draw(loader, mtx);
            
            //addChild(new Bitmap(bmpd));

            var canvas:Sprite = new Sprite();

            addChild(canvas);
            
            with(canvas.graphics)
            {                
                lineStyle(1, 0xFFFFFF);
                for (var i:int = 0; i<bmpd.height; i+=4)
                {
                    moveTo(0, i);                    
                    for (var ii:int = 0; ii<bmpd.width; ii+=2)
                    {
                        var rgb:ColorRGB = new ColorRGB();
                        rgb.value = bmpd.getPixel(ii,i);
                        var hsv:ColorHSV = rgb.toHSV();
                        lineStyle(1, rgb);
                        lineTo(ii,i+(Math.random()*5));
                    }
                }                
            }
            canvas.x = stage.stageWidth/2 - canvas.width/2;
            canvas.y = stage.stageHeight/2 - canvas.height/2;            
        }
    }
}