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

flash on 2010-2-11

Get Adobe Flash player
by y_k42uya 10 Feb 2010
    Embed
/**
 * Copyright y_k42uya ( http://wonderfl.net/user/y_k42uya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/8BHr
 */

package {
    import flash.display.Sprite;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.filters.BlurFilter;
    
    [SWF(backgroundColor = "0x000000", frameRate = "30")]
    
    public class FlashTest extends Sprite {
    		private var canvas:BitmapData;
    		private var color:uint;
    		private var size:Number = 10;
    		private var density:Number = 50;
        
        public function FlashTest() {
            init()
        }
        
        public function init():void {
        		canvas = new BitmapData(465, 465, false, 0x000000);
        		var bmp:Bitmap = new Bitmap(canvas);
        		bmp.filters = [new BlurFilter(2, 2, 3)];
        		addChild(bmp);
        		stage.addEventListener(MouseEvent.MOUSE_DOWN, mDown);
        		stage.addEventListener(MouseEvent.MOUSE_UP, mUp);
        		//addEventListener(Event.ENTER_FRAME, repeatFunc);
        }
        
        public function mDown(e:MouseEvent):void {
        		color = Math.random() * 0xFFFFFF + 0x000000;
        		addEventListener(Event.ENTER_FRAME, repeatFunc);
        }
        
        public function mUp(e:MouseEvent):void {
        		removeEventListener(Event.ENTER_FRAME, repeatFunc);
        }
        
        public function repeatFunc(e:Event):void {
        		for(var i:int = 0; i < density; i++){
        			var angle:Number = Math.random() * Math.PI * 2;
        			var radius:Number = Math.random() * size;
        			var xpos:Number = mouseX + Math.cos(angle) * radius;
        			var ypos:Number = mouseY + Math.sin(angle) * radius;
        			canvas.setPixel32(xpos, ypos, color);
        		}
        }
    }
}