Skip to content

Instantly share code, notes, and snippets.

@alecmce
Created August 17, 2010 20:16
Show Gist options
  • Save alecmce/531811 to your computer and use it in GitHub Desktop.
Save alecmce/531811 to your computer and use it in GitHub Desktop.
package ;
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.utils.ByteArray;
import flash.utils.Endian;
class Main extends Sprite
{
public static function main()
{
flash.Lib.current.addChild(new Main());
}
private static inline var WIDTH:Int = 1 << 8;
private static inline var HEIGHT:Int = 1 << 7;
private static inline var BYTES:Int = WIDTH * HEIGHT;
private var bitmap:BitmapData;
private var data:ByteArray;
public function new()
{
super();
bitmap = new BitmapData(WIDTH, HEIGHT, 0xFF1E90FF);
addChild(new Bitmap(bitmap));
data = new ByteArray();
data.endian = Endian.LITTLE_ENDIAN;
data.length = BYTES;
flash.Memory.select(data);
update();
}
private function update()
{
for (i in 0...BYTES)
flash.Memory.setI32(i << 2, 0xFFFFFFFF);
flash.system.ApplicationDomain.currentDomain.domainMemory.position = 0;
bitmap.lock();
bitmap.setPixels(bitmap.rect, flash.system.ApplicationDomain.currentDomain.domainMemory);
bitmap.unlock(bitmap.rect);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment