Import Com.adobe.images.PNGEncoder;
Import Com.adobe.images.JPGEncoder;
Import Flash.filesystem.File;
Import Flash.filesystem.FileStream;
Import Flash.filesystem.FileMode;
Import Flash.media.Camera;
Import Flash.media.Video;
Import flash.events.MouseEvent;
Import Flash.display.BitmapData;
Import Flash.utils.ByteArray; Security.showsettings (Securitypanel.camera);
Display Camera selection panel var cam:camera = Camera.getcamera (); Cam.setmode (738, 499, 24);
Camera window size var video:video = new Video (738,499);
Video.attachcamera (CAM);
This.addchild (video);
video.x = 276;
VIDEO.Y = 104;
This.addchild (BTN);
Full screen stage.displaystate = stagedisplaystate.full_screen_interactive;
Btn.addeventlistener (Mouseevent.mouse_down, Savestill);
var count:int = 0;
function Savestill (e:mouseevent): void{if (count >49) count = 0; var Mtr:matrix = new Matrix (476/738,0,0,370/499,0,0); Reduce the picture frame by proportional to the var bmd:bitmapdata = new BitmapData (476, 370);
Finally saved into the picture size Bmd.draw (video,mtr); Save as JPG picture var jpg:jpgeNcoder = new Jpgencoder ();
var ba:bytearray=jpg.encode (BMD);
/* Save as PNG picture var Ba:bytearray = Pngencoder.encode (BMD);
var file:file = File.desktopDirectory.resolvePath ("webcam" + count++ + ". png");
var file:file = File.documentsDirectory.resolvePath ("G:\PHPnow\htdocs\phpgetpic\upload\webcam" + count++ + ". png"); * * var file:file = File.applicationStorageDirectory.resolvePath ("G:\\phpnow\\htdocs\\phpgetpic\\upload\\webcam" +
count++ + ". jpg");
var filestream:filestream = new FileStream ();
Filestream.open (file, filemode.write);
Filestream.writebytes (BA);
Filestream.close ();
Socket broadcast out//SENDSTR ("webcam" + (count-1));
}
With the release of the "PHP to obtain local image files and generate XML file output" combined with the socket can be a computer to take pictures, another computer shows the photos taken.