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 2011-12-8

Get Adobe Flash player
by antalg 10 Dec 2011
    Embed
package {
    import flash.geom.Rectangle;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.geom.Point;
    import flash.filters.ColorMatrixFilter;
    import flash.events.Event;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            addChild(new Bitmap(_bmd));
            
            stage.addEventListener(Event.ENTER_FRAME, enterFrame);
            stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
        }
        
        private const SIDE:int = 465;
        private var _bmd:BitmapData = new BitmapData(SIDE, SIDE, false, 0x000000);
        private var _dir:Vector.<int> = new Vector.<int>();
        
        private var _cmf:ColorMatrixFilter = new ColorMatrixFilter([   1,   0,   0,   0,   0,
                                                                       0,   1,   0,   0,   0,
                                                                       0,   0,   1,   0,   0,
                                                                       0,   0,   0,   .97,   0]);
        private var _bf:BlurFilter = new BlurFilter(2, 2, 2);
        
        private function mouseMove(e:MouseEvent):void {
            var sq:int = 100;
            var s:int = 10;
            
            var vec:Vector.<uint> = new Vector.<uint>(sq, true);
            
            for(var i:int = 0; i<sq; i++) {
                vec[i] = 0xFFFFFFFF;
            }
            
            _bmd.setVector(new Rectangle(stage.mouseX-(s>>1), stage.mouseY-(s>>1), s, s), vec);
            e.updateAfterEvent();
        }
        
        private function enterFrame(e:Event):void {
            update();
            updateFilters();
        }
        
        private function updateFilters():void {
           _bmd.applyFilter(_bmd, _bmd.rect, new Point(0,0), _cmf);
           _bmd.applyFilter(_bmd, _bmd.rect, new Point(0,0), _bf);
        }
        
        private function update():void {
            
        }
    }
}