She walks in beauty like the night // Hypnotising the silence with her powers // Armageddon is bedding this picture alright // My Marilyn come to slum for an hour. An actionscript and music blog.

Snapshot of a Movie Clip

Posted: April 3rd, 2009 | Author: Janice | Filed under: Uncategorized | No Comments »

Here a simple way to get a snapshot on a movie clip in Flash.

+flash

you can get the JPGEncoder here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import com.adobe.images.JPGEncoder;
 
var enc:JPGEncoder = new JPGEncoder(90);
var file:FileReference = new FileReference();
 
stage.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void{
	capture();
}
 
// video is the instance name of whatever you want to capture 
var bit:BitmapData = new BitmapData(video.width, video.height, false, 0x000000);
addChild(new Bitmap(bit));
var counter:int = 0;
function capture():void {
	bit.draw(video);
	counter++;
	// save out each screen capture
	// file.save(enc.encode(bit), "myImage_" +counter+".jpg");
}