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

RIpple

[SWF(backgroundColor=0x0)]
Get Adobe Flash player
by yamadori 02 Sep 2010
/**
 * Copyright yamadori ( http://wonderfl.net/user/yamadori )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/mIA4
 */

package {
    
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    //[SWF(backgroundColor=0x0)]
    
    public class RippleEffect extends Sprite {
        
        private var flag:Boolean = false;
        private var timer:Timer;
        
        public function RippleEffect() {
            graphics.beginFill(0x000000);
            graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
            
            timer = new Timer( 1000 );
            timer.addEventListener( TimerEvent.TIMER, Time );
            timer.start();
        }
        
        private function Ripple():Sprite {
            
            var color:uint = Math.random() * 0xFFFFFF;
            
            var sp:Sprite = new Sprite();
            sp.graphics.lineStyle( 3, color, 1, true, "none" );
            sp.graphics.drawCircle( 0, 0, 5 );
            sp.x = mouseX;
            sp.y = mouseY;
            
            sp.addEventListener( Event.ENTER_FRAME, EnterFrame );
            
            function EnterFrame( e:Event ):void {
                
                var sp = e.target;
                sp.scaleX += 1;
                sp.scaleY += 1;
                sp.alpha -= 0.02;
                
                if( sp.alpha < 0 ) {
                    
                    sp.graphics.clear();
                    sp.removeEventListener( Event.ENTER_FRAME, EnterFrame );
                    removeChild( sp );
                    sp = null;
                }
            }
            return sp;
        }
        
        private function Time( e:TimerEvent ):void {
            
            var ripple:Sprite = Ripple();
            addChild( ripple );
            ripple.x = Math.random() * stage.stageWidth;
            ripple.y = Math.random() * stage.stageHeight;
        }
    }
}