SandStorm
package {
import com.flashdynamix.utils.SWFProfiler;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.PixelSnapping;
import flash.display.Sprite;
import flash.events.Event;
public class SandStorm extends Sprite {
public function SandStorm() {
SWFProfiler.init(this);
setupScreen();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private var _bitmapData:BitmapData;
private var _bitmap:Bitmap;
private function setupScreen():void {
_bitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x000000);
_bitmap = addChild(new Bitmap(_bitmapData, PixelSnapping.NEVER, false)) as Bitmap;
}
private function enterFrameHandler(e:Event):void {
var bitmapData:BitmapData = _bitmapData;
bitmapData.lock();
for (var px:uint=0; px<stage.stageWidth; px++) {
for (var py:uint=0; py<stage.stageHeight; py++) {
bitmapData.setPixel(px, py, 0xFFFFFF*Math.random());
}
}
bitmapData.unlock();
}
}
}