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: Bubbles += distance blur

Get Adobe Flash player
by sketchbookgames 03 Apr 2009
// forked from el_falcon's Bubbles
package {
    import flash.display.*;
    import flash.events.*;
    import flash.filters.BlurFilter;
    
    public class FlashTest extends Sprite {
        private var shapes:Array = [];
        public function FlashTest() {
            // write as3 code here..
            
            var maxCircles:int = 100;
            
            for(var i:uint=0; i< maxCircles ; i++) {
                var s:Shape = new Shape();
                addChild(s);
                var g:Graphics = s.graphics;
                g.lineStyle(Math.round(Math.random()*20), Math.round(Math.random()*0xffffff));
                var radius:Number = Math.round(Math.random()*80);
                g.drawCircle(0, 0, radius);
                s.x = Math.round(Math.random()*stage.width);
                s.y = Math.round(Math.random()*stage.height);
                //s.alpha = (81 - radius) / 85;
                s.cacheAsBitmap = true;
                var maxBlur:Number = 10;
                
                var thisBlur:Number = (maxCircles - i)/maxCircles * maxBlur
                s.filters = [new BlurFilter(thisBlur , thisBlur , thisBlur )]
                shapes.push({shape: s, speed: (100 - radius)/20});
            }
            
            stage.addEventListener(Event.ENTER_FRAME, move);
        }
        private function move (e:Event):void {
            for(var i:uint = 0; i<shapes.length; i++) {
                var s:Object = shapes[i];
                s.shape.y -= s.speed;
                if(s.shape.y + s.shape.height < 0) s.shape.y = stage.stageHeight + 50;
            }
        }
    }
}