Make duplicate display of webcam feed

This should be easy but I think my package is leaking somewhere. I’m not used to AS3; I’m one of those who voted that 2.0 still does everything that I needed - until now.

So, I’m trying to write some apps that will include some image processing for facial, object recognition. There’s a ton of stuff out there (mostly from 2009) that doesn’t work very well and I want to give it a try.

Anyway, I have the webcam feeding a video object I’ve addChild()ed to the stage and that works aces. I want to make a copy of that video stream and plop it on the stage right next to it. This works, but the framerate suffers:


public function update(event):void
{
	//onEnterFrame
	var bmp:BitmapData = new BitmapData(_video.width/5,_video.height/5);
	var mat:Matrix = new Matrix();
	var goat:Bitmap = new Bitmap(bmp);
	mat.scale(.2,.2);
	bmp.draw(_video, mat);
	mc:addChild(goat);
	goat.x = 320;
	goat.y = 0;
	goat.width = 320;
	goat.height = 240;

}

So this puts a pixelated version of the webcam feed right next to it just like I wanted, but it seems to lug down the processor. Logic would tell me that I’m piling on infinate amounts of “goat” to my movieClip (mc). I try to dispose() the bmp, but then it stops working. Any ideas? Why can’t I find anything like this on the interweb??