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: forked from: Bubbles

Get Adobe Flash player
by koutan 03 Mar 2009
// forked from paq's forked from: Bubbles
// forked from el_falcon's Bubbles
package {
    import flash.display.*;
    import flash.events.*;
    
    public class FlashTest extends Sprite {
        private var shapes:Array = [];
        public function FlashTest() {
            for(var i:uint=0; i<300; i++) {
                var s:Bubble = new Bubble();
                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;
                s.move = Math.random()*0.1;
                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.x += Math.sin(s.shape.wave);
                s.shape.wave += s.shape.move;
                if(s.shape.wave > 10)s.shape.wave = 0;
                s.shape.y -= s.speed;
                if(s.shape.y + s.shape.height < 0) s.shape.y = stage.stageHeight + 50;
            }
        }
    }
}

import flash.display.*;
class Bubble extends Shape {
        public var wave:Number = 0;    
        public var move:Number = 0; 
        public function Bubble():void {
            
        }
}