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

Bubbles

Get Adobe Flash player
by el_falcon 02 Mar 2009
package {
    import flash.display.*;
    import flash.events.*;
    
    public class FlashTest extends Sprite {
        private var shapes:Array = [];
        public function FlashTest() {
            // write as3 code here..
            for(var i:uint=0; i<300; 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;
                shapes.push({shape: s, speed: (81 - 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;
            }
        }
    }
}