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

Moon in Water

Get Adobe Flash player
by J.J 12 Mar 2013

    Talk

    bradsedito at 12 Mar 2013 02:30
    Creatively done. Nice work
    J.J at 13 Mar 2013 10:05
    Thanku man.
    makc3d at 14 Mar 2013 16:44
    This begs for some music ) Here's the plan, get rid of setInterval, draw circle every frame with alpha proportional to sound channel peaks.
    makc3d at 14 Mar 2013 17:02
    done :)
    J.J at 14 Mar 2013 21:10
    Thank you makc,this is good !
    Embed
/**
 * Copyright J.J ( http://wonderfl.net/user/J.J )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/rjzV
 */

package {
    import flash.filters.BlurFilter;
    import flash.utils.setInterval;
    import flash.display.BlendMode;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.events.Event;
    import flash.filters.ConvolutionFilter;
    import flash.geom.Matrix;
    import flash.display.Shape;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var h:Number,w:Number;
        private var mainbmp:BitmapData,bmpbuff:BitmapData,bmptmp:BitmapData
        private var cf:ConvolutionFilter
        private var rect:Rectangle
        private var p:Point
        private var circle:Shape
        public function FlashTest() {
            // write as3 code here..
            w=stage.stageWidth,h=stage.stageHeight;
            mainbmp=new BitmapData(w,h,false,0);
            bmpbuff=mainbmp.clone();
            stage.addChild(new Bitmap(mainbmp))
            circle=new Shape;
            circle.graphics.beginFill(0xffffff)
            circle.graphics.drawCircle(0,0,40);
            circle.x=circle.y=w/2
           // stage.addChild(circle)
            mainbmp.draw(circle,new Matrix(1,0,0,1,w/2,h/2));
            var  cmatrix:Array=[
            .5,1,.5,
            1 ,0, 1,
            .5,1,.5
            ]
            rect=mainbmp.rect;p=mainbmp.rect.topLeft
            cf=new ConvolutionFilter(3,3,cmatrix,3);
            addEventListener('enterFrame',loop);
             setInterval(drawCircle,500)
        }
        private function drawCircle():void{
            mainbmp.draw(circle,new Matrix(1,0,0,1,w/2,h/2));
            }
        private function loop(e:Event):void{
            bmptmp=mainbmp.clone();
            mainbmp.applyFilter(bmpbuff,rect,p,cf);
            mainbmp.draw(bmptmp,null,null,BlendMode.DIFFERENCE);
            bmptmp.dispose();
            bmptmp=bmpbuff;
            bmpbuff=mainbmp;
            mainbmp=bmptmp;
           
         }
    }
}