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: bubble

Get Adobe Flash player
by mmayu 07 May 2011
/**
 * Copyright mmayu ( http://wonderfl.net/user/mmayu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xrqW
 */

// forked from Scmiz's bubble
package {
    import flash.display.Sprite;
    import caurina.transitions.Tweener;

    public class FlashTest extends Sprite {
        public function FlashTest() {
            var proc:Function = function():void {
                addSphere(5);
                Tweener.addTween(this, {time:1, useFrames:true, onComplete:proc});
            }
            Tweener.addTween(this, {time:1, useFrames:true, onComplete:proc});
        }
        
        private function addSphere(num:uint):void {
            for (var index:uint = 0; index < num; ++index) {
                var r:uint = 128 + (128 * Math.random());
                var g:uint = 128 + (128 * Math.random());
                var b:uint = 128 + (128 * Math.random());
                var color:uint = (r << 16) + (g << 8) + (b << 0);
                var radius:Number = Math.random() * 30 + 10;
                var s:Sphere = new Sphere(color, radius);
                s.x = Math.random() * 465;
                s.y = Math.random() * 465;
                this.addChildAt(s, 0);
            }
        }
    }
}

import flash.display.Sprite;
import caurina.transitions.Tweener;

class Sphere extends Sprite
{
    public function Sphere(color:uint, radius:Number) {
        this.graphics.beginFill(color);
        this.graphics.drawCircle(0, 0, radius);
        this.graphics.endFill();
        
        this.alpha = 0;
        this.scaleX = 0;
        this.scaleY = 0;
        
        Tweener.addTween(this, {alpha:1, scaleX:1, scaleY:1, time:10, useFrames:true});
        var onCompleted:Function = function():void {
            parent.removeChild(this);
        };
        var scale:Number = 1.5;
        Tweener.addTween(this, { alpha:0, scaleX:scale, scaleY:scale, delay:10, time:15, useFrames:true, onComplete:onCompleted } );
    }
    
    public function end():void {
    }
}