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

noise test

http://livedocs.adobe.com/flex/2_jp/langref/flash/display/BitmapData.html#noise()
Get Adobe Flash player
by teageek 28 Jul 2009
    Embed
/**
 * Copyright teageek ( http://wonderfl.net/user/teageek )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/c3Xy
 */

//http://livedocs.adobe.com/flex/2_jp/langref/flash/display/BitmapData.html#noise()

package {
    import flash.display.Sprite;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.events.*;


    public class FlashTest extends Sprite {
        private var bmd1:BitmapData = new BitmapData(80, 80);
        private var bmd2:BitmapData = new BitmapData(80, 80);
        private var bmd3:BitmapData = new BitmapData(80, 80, false, 0x00CCCCCC);

        public function FlashTest() {
            // write as3 code here..
            
            var seed:int = int(Math.random() * int.MAX_VALUE);
            bmd1.noise(seed, 0, 0xFF, BitmapDataChannel.RED, false);
            bmd2.noise(seed, 0, 0xFF, BitmapDataChannel.RED, true); 

            var channels:uint = BitmapDataChannel.ALPHA |BitmapDataChannel.RED ;//|
                                //BitmapDataChannel.BLUE| BitmapDataChannel.GREEN;
            bmd3.perlinNoise(80, 80, 6, seed, false, true, channels, false, null);
            var c:int = new int();


            var bm1:Bitmap = new Bitmap(bmd1);
            this.addChild(bm1);
            bm1.x =100; bm1.y=150;
            var bm2:Bitmap = new Bitmap(bmd2);
            this.addChild(bm2);
            bm2.x = bm1.x+90; bm2.y=bm1.y;
            var bm3:Bitmap = new Bitmap(bmd3);
            this.addChild(bm3);
            bm3.x = bm2.x+90;bm3.y=bm2.y;
                  
            addEventListener("enterFrame",function():void{
                seed  = int(Math.random() * int.MAX_VALUE);
                bmd1.noise(seed, 0, 0xFF, BitmapDataChannel.RED, false);
                bmd2.noise(seed, 0, 0xFF, BitmapDataChannel.RED, true); 
                bmd3.perlinNoise(80, 80, 6,seed,false, true, channels, false, null);
                });
            
            
            
        }
        
    }
}