AS: Black and White
I've seen a few people asking how to do this with the new flash 8, so I thought i'd post a solution. It converts your movie/game's color matrix filters so it has no saturation, which ultima5tely means it's black and white.
NOTE: It can and WILL lag your movie/game, but not so much. But enough to make a difference
I'm sure the code could be cleaned up more than it is, and I don't care about that. Don't turn this into some kind of contest to see how can shorten it the most.
function blackAndWhite(clear) {
lastBW.bm.dispose();
lastBW.mc.removeMovieClip();
if(clear) return
var mc = createEmptyMovieClip("bw"+getNextHighestDe
pth(), getNextHighestDepth());
var bm = new flash.display.BitmapData(Stage.width, Stage.height);
mc.attachBitmap(bm, 0);
bm.draw(_root);
BWMATRIX = [.3086,.6094,.082,0,0,.3086,.6094,.082,0,0
,.3086,.6094,.082,0,0,0,0,0,1,0];
var cm = new flash.filters.ColorMatrixFilter(BWMATRIX);
bm.applyFilter(bm, bm.rectangle, new Point(0, 0), cm);
lastBW = {mc:mc, bm:bm};
}
The first few lines and last line save the last movieclips and bitmapdatas made and removes them next frame, so it doesn't waste memory.
NOTE: To turn OFF black and white, you need to call it with true as an argument.
To turn black and white, keep calling it every frame.
EXAMPLES:
Discontinued christmas project
Click the mouse on both of the examples to switch between color and B&W