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

manual bitmap noise

Get Adobe Flash player
by ish_xxxx 14 Jan 2009
// write as3 code here..
package {

    import flash.display.*;
    import flash.filters.*;
    import flash.events.*;
    import net.hires.debug.Stats;

    [SWF(frameRate="30",width="465",height="465",backgroundColor="0x0")]

    final public class App extends Sprite {
    
        private const PIXEL_INTERVAL:uint = 4;

        private var bmp:Bitmap;
        private var bmd:BitmapData;
        private var counter:uint = 0;

        public function App() : void {
            setup(); 
        }        

        protected function setup() : void {
            bmd = new BitmapData(stage.stageWidth,stage.stageHeight,true,0xFFFFFFFF);
            bmp = new Bitmap(bmd);
            addChild( bmp );
            addChild( new Stats() );
            addEventListener("enterFrame" , render, false , 0 , false );
        }

        protected function render( e:Event ) : void{
            if( ++counter % 2 == 0 ) draw() ;
        }
        protected function draw() : void {
            bmd.lock();
            for( var x:uint = 0; x <= bmd.width; x++ ) {
                for( var y:uint = 0; y <= bmd.height; y++ ) {
                    if( y % ( PIXEL_INTERVAL ) != 0 && x % ( PIXEL_INTERVAL / 2 ) != 0 )
                        bmd.setPixel( x , y , Math.random()*0xFFFFFF );
                }
            }
            bmd.unlock();
        }

    }

}