Created
August 17, 2010 20:16
-
-
Save alecmce/531811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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