Wednesday, 11 November 2009

action script for taking a screen grab of your image and turning it into a bitmap data

//(From previous section)
/* capture the video stream from the active webcam and display it inside the video object */

import flash.display.BitmapData
import flash.geom.Matrix


create a new bitmap object that is the same size
as the Video object to store the pixel data

var snapshot:BitmapData=new BitmapData(output_vid._width,output_vid._height);


create a function that takes a snapshot
of the Video object whenever it is called

function takeSnapshot()
//draw the current state of the Video object into
//the bitmap object with no transformations applied
snapshot.draw(output_vid,new Matrix());

No comments: