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-3-10

Get Adobe Flash player
by hashito 12 Mar 2010
    Embed
/**
 * Copyright hashito ( http://wonderfl.net/user/hashito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gEwU
 */

package {
    import flash.display.*;
    import flash.geom.*;
    import flash.events.*;
    import flash.utils.*;
    import flash.geom.*;
    import flash.filters.*;
    import net.hires.debug.Stats;
    
    [SWF(width="465", height="465", backgroundColor="0xFFFFFF" , rate="60")]
    public class Main extends Sprite {
        private const NUM_PARTICLE:uint = 1000;
        private const H:Number = 465;
        private const W:Number = 465;
       
        private var forceMap:BitmapData = new BitmapData( W, H, false, 0x000000 );
        //private var particleList:Vector.<Arrow> = new Vector.<Arrow>(NUM_PARTICLE, true);
        private var d:Sprite= new Sprite();
        private var dmap:Sprite= new Sprite();
        private var world:Sprite = new Sprite();
        
        public function Main() {
            addChild(world);
            world.addChild(new Bitmap(forceMap));
            world.addChild(dmap);
            d.graphics.beginFill(0);
            d.graphics.drawCircle(0,0,10);
            dmap.addChild(d);
            resetFunc();
            museinit();
            addChild(new Stats);
            addEventListener( Event.ENTER_FRAME, loop );
        }
        
        //loop
        private function loop( e:Event ):void {
            
            //var len:uint = particleList.length;
            //var col:Number;
            
            //for (var i:uint = 0; i < len; i++) {
                //var arrow:Arrow = particleList[i];
                //col = forceMap.getPixel( arrow.x , arrow.y );
                //arrow.update(
                //      ((col & 0xff)      - 0x80 ) * .0005 ,
                //      ((col >> 8 & 0xff) - 0x80 ) * .0005);
            //}
        }
        
        private function museinit():void{
           stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMove);
           stage.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
           stage.addEventListener(Event.MOUSE_LEAVE,mouseLeave);
           stage.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
        }
        private var mouseDownSt:Boolean=false;
        private function mouseDown( e:MouseEvent ):void {mouseDownSt=true;}
        private function mouseUp( e:MouseEvent ):void {mouseDownSt=false;}
        private function mouseLeave( e:Event ):void {mouseDownSt=false;}
        
        private var rect:Rectangle=new Rectangle(0,0,10,10);
        private var filter:BlurFilter=new BlurFilter(4,4,10);
        private function mouseMove( e:MouseEvent ):void {
        	d.x = mouseX;
        	d.y = mouseY;
            if(mouseDownSt){
              //forceMap.setPixel(,,0x0)
              forceMap.draw(dmap);
              //forceMap.generateFilterRect(rect,filter);
            }
        }
        
        //noise reset
        private function resetFunc(e:Event = null):void{
            forceMap.perlinNoise(W,H,30, Math.floor( Math.random() * 0xFFFFFF ), false, true, 6, false, null);
        }
    }
}