flash on 2010-12-24

by yama3
♥0 | Line 30 | Modified 2010-12-24 16:55:17 | MIT License
play

ActionScript3 source code

/**
 * Copyright yama3 ( http://wonderfl.net/user/yama3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/zFQT
 */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    [SWF(width='465', height='465', frameRate='60', backgroundColro='0xffffff')]
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            this.stage.scaleMode = StageScaleMode.NO_SCALE;
            this.stage.align = StageAlign.TOP_LEFT;
            addEventListener(Event.ADDED_TO_STAGE, init);            
        }
        
        private var bmd:BitmapData;
        private var bmp:Bitmap;
        private function init(evt:Event = null):void
        {
            this.bmd = new BitmapData(this.stage.stageWidth, this.stage.stageHeight, true, 0x00ffffff);
            this.bmd.perlinNoise(50, 50, 1, int(Math.random()*100), true, false, 15, false);
            this.bmp = new Bitmap(this.bmd);
            addChild(bmp);
            
            this.stage.addEventListener(MouseEvent.CLICK, onClick);
        }
        
        private function onClick(evt:MouseEvent):void {
            this.bmd.perlinNoise(50, 50, 1, int(Math.random()*100), true, false, 15, false);
        }


    }
}