White Noize
Test pixel drawing
/**
* Copyright tai2 ( http://wonderfl.net/user/tai2 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1Kz5
*/
package {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
public class WhiteNoize extends Sprite {
private var canvas:BitmapData;
public function WhiteNoize() {
canvas = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x000000);
addChild(new Bitmap(canvas));
addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame(event:Event) : void {
canvas.lock();
var x:int;
var y:int;
for (y = 0; y < canvas.height; y++) {
for (x = 0; x < canvas.width; x++) {
var v:int = 255 * Math.random();
canvas.setPixel(x, y, (v<<16) | (v<<8) | (v<<0));
}
}
canvas.unlock();
}
}
}