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 2010-2-12

Get Adobe Flash player
by hiro_rec 01 Sep 2012
/**
 * Copyright hiro_rec ( http://wonderfl.net/user/hiro_rec )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bvr5
 */

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BlendMode;
    import flash.display.Sprite;
    import flash.events.AsyncErrorEvent;
    import flash.events.Event;
    import flash.events.NetStatusEvent;
    import flash.events.SecurityErrorEvent;
    import flash.filters.BlurFilter;
    import flash.filters.ColorMatrixFilter;
    import flash.filters.GlowFilter;
    import flash.filters.GradientGlowFilter;
    import flash.geom.Point;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    
    
    [SWF (backgroundColor='#000000', frameRate=30)]
    
    public class Glow01 extends Sprite
    {
        private var container:Sprite;
        private var circle:Sprite;
        private var bmd:BitmapData;
        private var bmp:Bitmap;
        
        
        public function Glow01()
        {
            initDisplay();
            
            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }
        
        private function initDisplay():void
        {
            graphics.beginFill(0x0);
            graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);

            container = new Sprite();
            
            circle = new Sprite()
            circle.graphics.beginFill(0xFFFFFF)
            circle.graphics.drawCircle(0, 0, 20);
            container.addChild(circle);
            
            bmd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00000000);
            bmp = new Bitmap();
            bmp.bitmapData = bmd;
            bmp.blendMode = BlendMode.ADD;
            addChild(bmp);
        }
        
        private function enterFrameHandler(event:Event):void
        {
            bmd.draw(container);
            
            circle.x = mouseX;
            circle.y = mouseY;
            
            var point:Point = new Point();
            
            bmd.threshold(bmd, bmd.rect, point, "<", 0x00333333, 0x00000000, 0x00FF0000, true);
            
            var matrix:Array = [
                                1, 0, 0, 0, 0,
                                0, 1, 0, 0, 5,
                                0, 0, 1, 0, 2,
                                0, 0, 0, 1, -5
                                ];
            
            var matrixFilter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
            
            //bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x0000FF, 1, 6, 6, 20));
            bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x00ccff, 1, 6, 6, 10));
            bmd.applyFilter(bmd, bmd.rect, point, new BlurFilter(7, 7));
            bmd.applyFilter(bmd, bmd.rect, point, matrixFilter);
            bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x2375fd, 10, 10, 1, 5));
        }
    }
}