flex摄像头拍照 java上传到数据库 .

  • 来源:本站
  • 发布时间:2019-08-13
  • 19已阅读
您现在的位置:首页 >> 西方诗歌 >> 文章
简介 xmlversion=""encoding="utf-8"mx:Applicationxmlns:mx="http:///2006/mxml"layout="absolute"width="7

	flex摄像头拍照 java上传到数据库 .

xmlversion=""encoding="utf-8"mx:Applicationxmlns:mx="http:///2006/mxml"layout="absolute"width="750"height="600"creationComplete="initApp()"mx:StyleAlert{font-size:12px;}/mx:Stylemx:Script!--[CDATA[;;;;privatestaticconstDEFAULT_CAMERA_WIDTH:Number=160;//摄像头显示宽度privatestaticconstDEFAULT_CAMERA_HEIGHT:Number=120;//摄像头显示高度//privatestaticconstDEFAULT_WEBSERVICE_URL:String="http://localhost:1888/Web/";//WebService地址privatevarm_camera:Camera;//定义一个摄像头privatevarm_localVideo:Video;//定义一个本地视频privatevarm_pictureBitmapData:BitmapData//定义视频截图[Bindable]privatevarm_pictureData:String;privatefunctioninitApp():void{t_btn_=false;t_ban_=false;initCamera();}//初始化摄像头privatefunctioninitCamera():void{m_camera=();if(m_camera!=null){m_(,__onCameraStatusHandler);m_(DEFAULT_CAMERA_WIDTH,DEFAULT_CAMERA_HEIGHT,30);m_localVideo=newVideo();m_=DEFAULT_CAMERA_WIDTH;m_=DEFAULT_CAMERA_HEIGHT;m_(m_camera);t_vd_(m_localVideo);}else{("没有找到摄像头,是否重新查找。 ","提示:",|,this,__InitCamera);return;}}//拍照按钮事件,进行视频截图privatefunctionSnapshotPicture():void{m_pictureBitmapData=newBitmapData(DEFAULT_CAMERA_WIDTH,DEFAULT_CAMERA_HEIGHT);m_(t_vd_Video,newMatrix());varm_pictureBitmap:Bitmap=newBitmap(m_pictureBitmapData);t_img_(m_pictureBitmap);t_panel_=true;t_ban_=true;}//保存按钮事件,保存视频截图//通过WebService保存//privatefunctionSavePicture():void//{//m_pictureData="";//for(vari:int=0;iDEFAULT_CAMERA_WIDTH;i++)//{//for(varj:int=0;jDEFAULT_CAMERA_HEIGHT;j++)//{//if(m_)//{//m_pictureData+=","+m_(i,j).toString();//}//else//{//m_pictureData=m_(i,j).toString();//}//}//}////t_ws_();//}//检测摄像头权限事件privatefunction__onCameraStatusHandler(event:StatusEvent):void{if(!m_){t_btn_=true;}else{("无法链接到活动摄像头,是否重新检测。

","提示:",|,this,__InitCamera);}m_(,__onCameraStatusHandler);}//当摄像头不存在,或连接不正常时重新获取privatefunction__InitCamera(event:CloseEvent):void{if(==){initApp();}}//WebService保存图片成功事件privatefunction__onSavePictureResult(event:ResultEvent):void{//trace();if(()=="保存成功"){((),"提示",,this,__onAlertCloseHandler);}else{((),"提示",);}}//连接WebService失败事件privatefunction__onSavePictureFault(event:FaultEvent):void{//((),"提示",);("连接WebService失败。 ","提示",);}//保存图片成功后的弹出窗口确认事件privatefunction__onAlertCloseHandler(event:CloseEvent):void{if(==){//trace("转向页面");}}publicfunctionSavePicture(){varparams:URLVariables=newURLVariables();m_pictureData="";for(vari:int=0;iDEFAULT_CAMERA_WIDTH;i++){for(varj:int=0;jDEFAULT_CAMERA_HEIGHT;j++){if(m_){m_pictureData+=","+m_(i,j).toString();}else{m_pictureData=m_(i,j).toString();}}}=DEFAULT_CAMERA_WIDTH;=DEFAULT_CAMERA_HEIGHT;_data=m_pictureData;="http://localhost:8088/archive/savepicturesrv";(params);}]]--/mx:Scriptmx:HTTPServiceshowBusyCursor="true"id="savePictureService"method="POST"resultFormat="xml"fault="__onSavePictureFault(event)"result="__onSavePictureResult(event)"/mx:Panelx="10"y="10"width="180"height="200"layout="absolute"title="视频拍照"fontSize="12"mx:VideoDisplayid="t_vd_Video"width="160"height="120"/mx:ControlBarhorizontalAlign="right"mx:Buttonid="t_btn_Shooting"label="拍照"click="SnapshotPicture()"//mx:ControlBar/mx:Panelmx:Panelid="t_panel_Picture"x="198"y="10"width="180"height="200"layout="absolute"title="拍照图片"fontSize="12"visible="false"mx:Imageid="t_img_Picture"x="0"y="0"width="160"height="120"/mx:ControlBarhorizontalAlign="right"mx:Buttonid="t_ban_Save"label="保存"click="SavePicture()"//mx:ControlBar/mx:Panel/mx:Applicationjava代码:。