# Webcam Demo

**URL:** <https://forum.kirupa.com/t/webcam-demo/192365>\
**Category:** open source\
**Created:** [June 28, 2006, 3:34am UTC](https://forum.kirupa.com/t/webcam-demo/192365 "2006-06-28T03:34:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yeldarb](https://avatars.discourse-cdn.com/v4/letter/y/51bf81/32.png) [@Yeldarb](https://forum.kirupa.com/u/Yeldarb)\
**Post date:** [June 28, 2006, 3:34am UTC](https://forum.kirupa.com/t/webcam-demo/192365/1 "2006-06-28T03:34:08Z")

</div>

I’m trying to explore the features of Flash 8, which I just got. This is my first little experiment with it.

For those of you without a webcam, it basically just displays two images, one positive, one negative (inverted) of what your webcam is seeing.

```auto
import flash.display.*;
import flash.geom.*;

cam = Camera.get();
pos.attachVideo(cam);
var drawPos = new BitmapData(cam.width, cam.height);
var drawNeg = new BitmapData(cam.width, cam.height);

_root.createEmptyMovieClip("neg", 1);
neg._x = 320;

rect = new Rectangle(0, 0, cam.width, cam.height)
point = new Point(0, 0);
onEnterFrame = function() {
	drawNeg.copyPixels(drawPos, rect, point);
	for(var i=0; i<cam.height; i++) {
		for(var j=0; j<cam.width; j++) {
			drawNeg.setPixel(j, i, 255-drawNeg.getPixel(j, i));
		}
	}
	drawPos.draw(pos);
	neg.attachBitmap(drawNeg, 0);
	neg._xscale = 200;
	neg._yscale = 200;
}

```

It’s very simple, but it’s my first experiment with Flash 8. I used a couple of tutorials online as a starting point for figuring out the whole Bitmap manipulation and webcam thing, plus a lot of reading through the docs.

Edit: I think I might have a go at creating a Photobooth style app in Flash.
