Read and Save a User's Webcam Image
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Canvas width="400" height="500"> <mx:Script> import flash.net.navigateToURL; import flash.net.sendToURL; import mx.graphics.codec.JPEGEncoder; private var cam:Camera = flash.media.Camera.getCamera("2"); private function saveImage():void { vid.attachCamera(cam); var bitmapData:BitmapData = new BitmapData(vid.width, vid.height); bitmapData.draw(vid); var encode:JPEGEncoder = new JPEGEncoder(100); var ba:ByteArray = encode.encode(bitmapData); } </mx:Script> <mx:VideoDisplay id="vid" width="360" height="320"/> <mx:Button label="Take Picture Now" click="saveImage()"/> </mx:Canvas> </mx:Application>