网络摄像头解决问题

时间:2011-01-19 13:33:30

标签: actionscript webcam

我今天提交的问题已得到正确解决,但我有另一个问题。

我希望网络摄像头为640x480并且它正常工作,我希望将其保存为640x480,但它目前保存在320x240 !!

这是代码。

var bandwidth:int = 0; 
var quality:int = 100;


var cam:Camera = Camera.getCamera();
if(cam==null)
 trace("err")
else
{
 cam.addEventListener(StatusEvent.STATUS,statusHandler);
function statusHandler(evt:StatusEvent):void
{
 if(cam.muted)
 {
 }
 else
 {
  trace(cam.width)

 }
}


cam.setQuality(bandwidth, quality);
cam.setMode(8192,6144,30,false); // setMode(videoWidth, videoHeight, video fps, favor area)

var videoToCapture:Video = new Video();
videoToCapture.attachCamera(cam);
videoToCapture.width=640;
videoToCapture.height=480;
videoToCapture.x = 12;
videoToCapture.y = 13;
addChild(videoToCapture);

var bitmapDataToCapture:BitmapData = new BitmapData(videoToCapture.width, videoToCapture.height, false, 0x000000);
var bitmapToCapture:Bitmap = new Bitmap(bitmapDataToCapture);
addChild(bitmapToCapture);
bitmapToCapture.x=700;
bitmapToCapture.y=13;





capture_mc.buttonMode = true;
capture_mc.mouseChildren=false; 
capture_mc.addEventListener(MouseEvent.CLICK,captureImage);




function captureImage(e:MouseEvent):void 
{   
 bitmapDataToCapture.draw(videoToCapture);
 //bitmapDataToSend.draw(videoToSend);
} 

您可以通过查看此问题来查看问题..

http://img233.imageshack.us/i/imgmib.jpg/

感谢您的帮助..

1 个答案:

答案 0 :(得分:0)

更改此行

cam.setMode(8192,6144,30,false);

到这个

cam.setMode(640,480,30,false);