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 2010-5-26

Get Adobe Flash player
by niong 26 May 2010
/**
 * Copyright niong ( http://wonderfl.net/user/niong )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1O68
 */

// forked from niong's flash on 2010-5-26
package {
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Matrix;
    import flash.geom.Point;
    import flash.filters.BlurFilter;
    
    [SWF(width=465,height=465,frameRate=60, backgroundColor=0x000000)]
    public class FlashTest extends Sprite {
    	
    	    private var s:Sprite;
    	    private var bmp:Bitmap;
    	    private var r:Number = 1 * (Math.PI/180);
    	    private var mat:Matrix;
    	    
        public function FlashTest() {
            s = new Sprite();
            addChild(s);
            bmp = addChild( new Bitmap( new BitmapData( 450, 450, true, 0x00000000 ) ) ) as Bitmap;
            stage.addEventListener( MouseEvent.MOUSE_UP, initialize );
            initialize(null);
            addEventListener(Event.ENTER_FRAME, draw );
        }
        
        private function initialize( e:MouseEvent ):void{
        	
        	    	var sw:Number = 465;
	        var sh:Number = 465;
	        mat = new Matrix();
	        s.graphics.clear(); 
	        bmp.bitmapData.fillRect( bmp.bitmapData.rect, 0x000000 );
        	    for( var i:uint = 0; i < 3; ++i ) {
        	         s.graphics.lineStyle( 1, 0x000000, .01);
	             s.graphics.beginFill( ( Math.random()*0xffffff  ), .05 );
	             s.graphics.drawCircle( Math.random()*150, Math.random()*150,   int( Math.random()*50 ) + 10  );
	             s.graphics.endFill()
	             
            }
        }
        
        private function draw( e:Event ):void{
           	mat.translate(-mouseX, -mouseY);
	        mat.rotate( r );
	        
	        mat.translate(mouseX, mouseY);
	        bmp.bitmapData.draw( s, mat, null, "add" );
	        bmp.bitmapData.applyFilter( bmp.bitmapData, bmp.bitmapData.rect, new Point(), new BlurFilter( 2, 2, 1) ); 
        }
        
    }
}