bitmapdatatest2

by k2syndrome_g forked from bitmapdatatest1 (diff: 27)
♥0 | Line 37 | Modified 2011-02-19 21:18:46 | MIT License
play

ActionScript3 source code

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

// forked from k2syndrome_g's bitmapdatatest1
package {
    import flash.geom.Point;
    import flash.events.Event;
    import flash.geom.Matrix;
    import flash.geom.Rectangle;
    import flash.text.TextField;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var bitmapdata:BitmapData;
        private var bitmapdata2:BitmapData;
        private const PLUS:int=50;
        private var changed:int=0;
        private var seed:int=int.MAX_VALUE*Math.random();
        public function FlashTest() {
            bitmapdata=new BitmapData(100,100,true,0xFF0000FF);
            for(var i:int=0;i<bitmapdata.width;i++){
                bitmapdata.setPixel32(i,i,0xFFFFFFFF);
            }
            bitmapdata.fillRect(new Rectangle(0,0,50,50),0xFF00FF00);
            bitmapdata.floodFill(70,0,0xFFFF0000);
            bitmapdata2=new BitmapData(100,100,true,0xFFFFFFFF);
            //
            var bitmap:Bitmap=new Bitmap(bitmapdata2);
            bitmap.y=100;
            addChild(bitmap);
            addEventListener(Event.ENTER_FRAME,onEnterFrameListener)
        }
        private function onEnterFrameListener(event:Event):void{
            seed=bitmapdata2.pixelDissolve(bitmapdata,bitmapdata2.rect,new Point(),seed,PLUS);           
            if(bitmapdata2.width*bitmapdata2.height<=changed){
                removeEventListener(Event.ENTER_FRAME,onEnterFrameListener);
            }
            changed+=PLUS;
        }
    }
}

Forked