Hi guys, I’m a beginner in Flash AS3 and I want to ask some questions in this community. I have been having some troubles in taking a snapshot using a webcam in my flash application. My webcam flash application is supposed to take a snapshot and save it in mysql server.
I have a small space in my flash application to put the camera so I have set my camera to show up in my flash application at (160,120) resolution size so that the camera preview will not take up much space in my application. I have a button_takepicture that allows the user to take picture with it and it will be saved in the server. However, the picture is saved at (160,120) resolution, which is a super small picture when I view it in the server.
Is there any way to set the size of the camera showing up in flash but will not affect the resolution of the saved picture? I want my resolution of the saved picture to be 300x400 and the camera box in flash to be a small size but not a 300x400 size because my stage size is only 550x400.
figure 1a.
as u can see in my flash application, the black box is 160x120 in size, it is the size of the camera preview that I want in my flash application. But in my server, the picture resolution size is also 160x120 (I want a 300x400 instead)
figure 1b.
if i set it to a higher resolution, the camera preview will fill up my flash application. (shown as a red box. 300x400 size) (this is not I want because it takes up huge space)
What should I do if I want my camera size in my flash to look like figure 1a but in my snapshot saved picture in server to be a 300x400 size?
Please help.
Thanks alot !
//setup my camera
setupCamera(160,120);
function setupCamera(w:int,h:int):void {
try {
camera = Camera.getCamera();
} catch(e:Error) {
trace("No Camera detected!");
}
camera.addEventListener(StatusEvent.STATUS, camStatusHandler);
camera.setMode(w,h,stage.frameRate);
video = new Video(w,h);
video.attachCamera(camera);
video.x = 350;
video.y = 20;
addChild(video);
}
//cam function takephoto
function takephoto(e:MouseEvent):void
{
imgBD = new BitmapData(video.width,video.height);
imgBD.draw(video);
imgBitmap = new Bitmap(imgBD);
imgBitmap.x = 350;
imgBitmap.y = 20;
addChild(imgBitmap);
screenSActive = true;
but_capture.removeEventListener(MouseEvent.CLICK, takephoto);
}