0
我已经编写了足够的代码来预览Flash中的网络摄像机视频。保存从网络摄像头捕获的静态图像在Flash中
现在,我想以10秒的间隔捕捉图像。
这里是我的代码:
import flash.display.BitmapData
import flash.geom.Matrix
import com.adobe.images.JPGEncoder;
import flash.net.FileReference;
//get the default camera
//change your Default camera using the Flash Player Settings.
cam=Camera.get()
//this event is called whenever permission to access the local camera, is accepted or denied by the user
cam.onStatus=function(e)
{
//if we are given permission
if(e.code == "Camera.Unmuted")
{
//start the application
initialize()
}
else
{
System.showSettings(3)
}
}
var snapshot:BitmapData=new BitmapData(cam._width,cam._height);
function takeSnapshot()
{
snapshot.draw(cam,new Matrix());
}
//if there are no Cameras
if(cam == null)
{
System.showSettings(3)
}
else
{
cam.setMode(1024, 768, 30);
cam.setQuality(10000,0);
output.attachVideo(cam);
setInterval(this,"takeSnapshot",1000);
}
任何帮助吗?
我是一个总的Flash新手。
谢谢, Rishi。
您使用的是ActionScript 2还是3? – 2010-07-15 00:53:05
ActionScript 2,我认为.. – 2010-07-15 08:33:16
这就是actionscript 3的语法:)这可能很好地解释它:http://www.gotoandlearn.com/play.php?id = 44 ...用JPEG取代PNGEncoder,文件等 – 2010-07-20 10:51:46