Chapter 36 Example 16 actionscript.. forked:0favorite:0lines:28license : MIT License modified : 2010-02-09 15:05:31 Embed Tweet package { import flash.display.*; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.TimerEvent; [SWF(frameRate="2")] public class ch36ex16 extends Sprite { protected var bmp:BitmapData; protected var stitch:Boolean = false; public function ch36ex16() { bmp = new BitmapData(200, 200); var shape:Shape = new Shape(); shape.graphics.lineStyle(0, 0, 0); shape.graphics.beginBitmapFill(bmp); shape.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); shape.graphics.endFill(); addChild(shape); stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); addEventListener(Event.ENTER_FRAME, onEnterFrame); } protected function onKeyDown(event:KeyboardEvent):void { stitch = !stitch; } private function onEnterFrame(event:Event):void { bmp.perlinNoise(100, 100, 2, Math.random()*1000, stitch, false, 1, true); } } } Code Fullscreen Preview Fullscreen as3bible bitmap noise perlin stitching beginBitmapFill Shape perlinNoise TimerEvent.ENTER_FRAME drawRect addEventListener endFill lineStyle BitmapData stageWidth stageHeight Boolean addChild Math.random Sprite