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

code on 2008-12-23

Get Adobe Flash player
by casualplay 25 Mar 2009
    Embed
// write as3 code here..
package
{
    import caurina.transitions.*;    

    import flash.display.*;
    import flash.events.*;
    import flash.filters.*;
    import flash.geom.*;
    import flash.utils.*;
    
    public class Test extends Sprite
    {
        public var sp:Sprite;
        public var bmp:Bitmap;
        private var bmd:BitmapData;
        public function Test()
        {
            var bg:Sprite = new Sprite();
            bg.graphics.beginFill(0x000000);
            bg.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
            bg.graphics.endFill();
            this.addChild(bg);
            
            bmd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00000000);
        
            bmp = new Bitmap(bmd);
            bmp.x = 0;
            bmp.y = 0;
            var gf:GlowFilter = new GlowFilter(0x00AAAA, 1, 16, 16, 2, 2);
            var bf:BlurFilter = new BlurFilter(64, 64, 2);
            sp = new Sprite();
            sp.graphics.beginFill(0x000000);
            sp.graphics.drawCircle(0, 0, 120);
            sp.graphics.endFill();
            sp.x = stage.stageWidth/2;
            sp.y = stage.stageHeight/2;
            sp.filters = [bf, gf];
            this.addChild(sp);
            this.addChild(bmp);
            var tm:Timer = new Timer(80);
            tm.addEventListener(TimerEvent.TIMER, addParticle);
            tm.start();

            //this.addEventListener(Event.ENTER_FRAME, drawBmp);
        }
        
        private function addParticle(e:Event):void
        {
            var distance:Number = 90;
            var p:Sprite = sp;
            var s:Sprite = new Sprite();
            var clrSet:Array = [0x002131, 0x332111, 0x1c3e21];
            var clr:Number = clrSet[Math.floor(Math.random()*clrSet.length)];
            s.graphics.beginFill(clr);
            s.graphics.drawCircle(0, 0, 120);
            s.graphics.endFill();
            s.blendMode = "add";
            p.addChild(s);            
            
            Tweener.addTween(s, {scaleX:0, scaleY:0,time:1.7, transition:"easeOutSine"});
            Tweener.addTween(s, {x:Math.random()*distance*2-distance, y:Math.random()*distance*2-distance, time:1.7, transition:"easeOutExpo", onComplete:removeParticle, onCompleteParams:[s]});
        }

        private function drawBmp(event:Event)
        {
            var bevel:BevelFilter = new BevelFilter(12, 45, 0xffff88, 1, 0x000000, 1, 32, 32, 1, 3);
            var mat:Matrix = new Matrix(1, 0, 0, 1, stage.stageWidth/2, stage.stageHeight/2);
            var rect:Rectangle = bmd.rect;
            var point:Point = new Point(0, 0);
            var tmpBmp:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
            tmpBmp.draw(sp, mat);
            bmd.threshold(tmpBmp, rect, point, "<", 0xffccffff, 0xffffff33, 0xffffffff, false);
            bmd.threshold(tmpBmp, rect, point, ">", 0xffccffff, 0x00000000, 0xffffffff, false);
            bmd.applyFilter(bmd, rect, point, bevel);
        }
        
        private function removeParticle(p:Sprite):void
        {
            sp.removeChild(p);
        }
    }
}