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

Simple Pixel

Simple way image =~> pixel black and white
/**
 * Copyright IPFix ( http://wonderfl.net/user/IPFix )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/vWDR
 */

package{
    import com.greensock.TweenMax;
    import flash.display.*;
    import flash.events.Event;
    import flash.geom.Matrix;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    
    [SWF(backgroundColor="#DDDDDD", width="465", height="465", frameRate="60")]

    public class Main extends Sprite{
        private const URL:String = "http://bkmrk.abakane.com/lab/lib/monalisa.jpg";
        private var _canvas:BitmapData;
        private static const W:uint = 15;
        private static const H:uint = 15;
    
        public function Main(){
            Wonderfl.capture_delay(2);
            if( stage ) init();
            else addEventListener( Event.ADDED_TO_STAGE, init);
        }
        
        private function init( e:Event=null ):void
        {
            removeEventListener( Event.ADDED_TO_STAGE, init);
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onComplete);
            loader.load( new URLRequest(URL), new LoaderContext(true) );
            addChild(loader);
        }
        
        private function onComplete( e:Event ):void
        {
            e.target.removeEventListener( Event.COMPLETE, onComplete);
            var bmpd:BitmapData = e.target.content.bitmapData;
            var bitmap:Bitmap = new Bitmap(bmpd);
            TweenMax.to( bitmap, 0, {colorMatrixFilter:{colorize:0xffffff, amount:1, contrast:1.1, brightness:2.5}});
            var m:Matrix = new Matrix();
            m.scale( 1/W, 1/H);
            _canvas = new BitmapData( bmpd.width/W, bmpd.height/H, false, 0);
            _canvas.draw( bitmap, m );
            bitmap = new Bitmap(_canvas);
            //bitmap.scaleX = stage.stageWidth/bitmap.width;
            //bitmap.scaleY = stage.stageHeight/bitmap.height;
            //addChild( bitmap );
            for( var i:int = 0; i< bitmap.width; i++){
                for(var j:int = 0; j < bitmap.height; j++ ){
                    var sprite:Sprite = new Sprite();
                    sprite.graphics.beginFill(bitmap.bitmapData.getPixel(i,j));
                    sprite.graphics.drawRect(0,0,W,H);
                    addChild( sprite );
                    sprite.x = i*W;
                    sprite.y = j*H;
                    sprite.alpha = 0;
                    TweenMax.to(sprite,.3,{delay:(i+j)*0.05,alpha:1});
                }
            }

        }
    }
}