AS3 Webcam

var bandwidth:int = 0; // Specifies the maximum amount of bandwidth that the current outgoing video feed can use, in bytes per second. To specify that Flash Player video can use as much bandwidth as needed to maintain the value of quality, pass 0 for bandwidth. The default value is 16384. var quality:int = 50; // this value is 0-100 with 1 being the lowest quality. Pass 0 if you want the quality to vary to keep better framerates

// create the camera object (the computer getting your webcam image) var camera:Camera = Camera.getCamera; camera.setQuality(bandwidth, quality); camera.setMode(320,240,15,true); // setMode(videoWidth, videoHeight, video fps, favor area)

// Now attach the webcam stream to a video object. var video:Video = new Video; video.attachCamera(camera);

box.addChild(video);

addEventListener(Event.ENTER_FRAME,update);

function update(evt:Event){ box.x = mouseX; box.y = mouseY; }