Step 5 For conversion to black and white, add the code below before the code you’ve written in Step 4. This defines the red, green and blue variables.

var r:Number=0.212671;
var g:Number=0.715160;
var b:Number=0.072169;

To put those variables into an array, enter this code, which applies a filter to the scene, then transforms its colour by using the above matrix array.

var ct_matrix:Array=[];
ct_matrix=ct_matrix.concat([r,g,b,0,0]);// red
ct_matrix=ct_matrix.concat([r,g,b,0,0]);// green
ct_matrix=ct_matrix.concat([r,g,b,0,0]);// blue
ct_matrix=ct_matrix.concat([0,0,0,1,0]);// alpha
scene.filters=[new ColorMatrixFilter(ct_matrix)];


Step 6 We’ll use blend modes to create the red and cyan to work with anaglyphic 3D glasses. These work just like Photoshop’s blending modes. Add this immediately after the code from Step 5 to tint the bitmap.

var ctLeftRed:ColorTransform=new
ColorTransform(1,0,0);
var ctRightCyan:ColorTransform=new
ColorTransform(0,1,1);
bmpScene.bitmapData.draw(scene, null, ctLeftRed,
BlendMode.NORMAL);

On publishing, you’ll see that the output is tinted red. Now add this code after the above line, which will superimpose a second duplicate and tint it cyan:

bmpScene.bitmapData.draw(scene, null, ctRightCyan, BlendMode.ADD);

When you publish this, the output will be monochrome. This is because the left and right views are positioned on top of each other.