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 2009-7-18

Get Adobe Flash player
by Rnkn 18 Jul 2009
package {
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    public class FlashTest extends Sprite {
        
        public var bubb:Array = new Array();
        public var speed:Array = new Array();
        public var xp:Array = new Array();
        public var hankei:Array = new Array();
        public var rad:Array = new Array();
        public var max:int = 700;
        public var timer:Timer;
        
        public function FlashTest() {
          
             for(var i:int = 0;i<max;i++) {   
                createBubb(i);
             }
           
           timer = new Timer(33);
           timer.addEventListener(TimerEvent.TIMER, _loop);
           timer.start();  
        }
        
        public function createBubb (num:int):void {
            bubb[num] = new Shape();
            bubb[num].name = num;
            this.addChild(bubb[num]);
            bubb[num].graphics.lineStyle(0,0);
            bubb[num].graphics.beginFill(0x000000);
            bubb[num].graphics.drawCircle(0,0,1);
            bubb[num].graphics.endFill();
            
            var scl:Number = Math.random()*2;
            
            bubb[num].scaleX = scl;
            bubb[num].scaleY = scl;
            bubb[num].alpha = scl/2;
            bubb[num].x = Math.random()*40+this.stage.stageWidth/2-10;
            bubb[num].y = Math.random()*bubb[num].height+this.stage.stageHeight;
            
            xp[num] = bubb[num].x;
            hankei[num] = Math.random()*3+2;
            rad[num] = 1;
            speed[num] = Math.random()*2*scl+2;
        }
        
        public function _loop (event:TimerEvent):void {
            for(var i:int = 0;i<bubb.length;i++) {
               
               var scale:Number = Math.random()/30+1;
               
               bubb[i].scaleX *= scale;
               bubb[i].scaleY *= scale;
               bubb[i].alpha -= Math.random()*0.003; 
               bubb[i].y -= speed[i];
               rad[i] += Math.random()*10;
               
               bubb[i].x = Math.cos(rad[i]*Math.PI/180)*hankei[i]+xp[i];
               
               hankei[i] *= 1.02;
               speed[i] *= 1.005;
               
               if (bubb[i].y < -10 || bubb[i].alpha < 0.1) {
                   var num:int = bubb[i].name;
                   removeChild(bubb[i]);
                   createBubb(num);
               }
             }
        } 
    }
}