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

foo

foooooooooo!!
Get Adobe Flash player
by Susisu 17 Apr 2012
    Embed
package {
    import flash.display.Sprite;
    import flash.events.Event;
    [SWF(width="465",height="465",frameRate="60",backgroundColor="0xffffff")]
    public class FlashTest extends Sprite {
        private var foos:Vector.<Foo>;
        
        public function FlashTest() {
            foos=new Vector.<Foo>();
            
            for(var i:int=0;i<2000;i++){
                var foo:Foo=new Foo();
                foo.x=Math.random()*465;
                foo.y=Math.random()*465;
                addChild(foo);
                foos.push(foo);
            }

            addEventListener(Event.ENTER_FRAME,onEnterFrame);
        }
        private function onEnterFrame(e:Event):void{
            var l:int=foos.length;
            for(var i:int=0;i<l;i++){
                var foo:Foo=foos[i];
                var dx:Number=foo.x-mouseX;
                var dy:Number=foo.y-mouseY;
                var vx:Number=foo.vx;
                var vy:Number=foo.vy;
                if(dx*dx+dy*dy<=10000){
                    vx+=dx*0.01;
                    vy+=dy*0.01;
                }
                vx*=0.95;
                vy*=0.95;
                
                vx+=Math.random()-0.5;
                vy+=Math.random()-0.5;
                
                var x:Number=foo.x+=vx;
                var y:Number=foo.y+=vy;
                
                if(x<0||x>465||y<0||y>465){
                    var r:Number=Math.atan2(y-465/2,x-465/2);
                    vx=-Math.cos(r);
                    vy=-Math.sin(r);
                }
                
                foo.vx=vx;
                foo.vy=vy;

            }

        }

    }
}
import flash.display.Sprite;
import flash.display.Graphics;
class Foo extends Sprite{
    public var vx:Number;
    public var vy:Number;
    public function Foo(){
        var g:Graphics=graphics;
        g.lineStyle(1,0x000000);
        g.beginFill(0xffffff);
        g.drawEllipse(-16,-8,32,16);
        g.endFill();
        g.moveTo(-10,-1);
        g.lineTo(-8,-5);
        g.lineTo(-6,-1);
        g.moveTo(10,-1);
        g.lineTo(8,-5);
        g.lineTo(6,-1);
        g.drawCircle(0,2,2);
        
        cacheAsBitmap=true;
        
        vx=0;
        vy=0;
    }

}