Frame action
createEmptyMovieClip("drawing", 1);
_root.bitmap = new flash.display.BitmapData(400,400, true, 0xFF666666);
drawing.attachBitmap(_root.bitmap, 10, "auto", true);
pixel(100, 100, 0xFFFFFF);
function pixel(px, py, color) {
_root.bitmap.setPixel(px, py, color);
}
var drawing:MovieClip = new MovieClip();
var bitmap = new BitmapData(400,400, true, 0xff666666);
var bitmap2:Bitmap = new Bitmap(bitmap);
addChild(bitmap2);
pixel(100,100, 0xffffff );
addChild(drawing);
function pixel(px:int, py:int, color:int) {
bitmap.setPixel(px,py, color);
}
In Actionscript, there is no direct way of drawing pixels. This, somewhat intricate, solution makes use of the Bitmapdata class. A (virtual) bitmap is created and attached to the movieclip known as drawing. The command setPixel can then be used to draw a pixel of any color, e.g. white: 0xffffff. Can you see it?