Home  >  Article  >  Backend Development  >  flex + php

flex + php

WBOY
WBOYOriginal
2016-07-20 11:05:291058browse

flex+php捦ㄧ玷鎷翷综合



 
        Alert{font-size:12px;}
   

   
                    import mx.events.CloseEvent;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
             import mx.managers.CursorManager;
            private static const DEFAULT_CAMERA_WIDTH:Number = 160; //鎽勫儚澶存樉绀哄搴?br />            private static const DEFAULT_CAMERA_HEIGHT:Number = 120; //鎽勫儚澶存樉绀洪珮搴?br />            private static const DEFAULT_WEBSERVICE_URL:String = "http://localhost:1888/Web/TestWebService.asmx?WSDL"; //WebService鍦板潃
           
            private var m_camera:Camera; //瀹氫箟涓€涓憚鍍忓ご
            private var m_localVideo:Video; //瀹氫箟涓€涓湰鍦拌棰?br />            private var m_pictureBitmapData:BitmapData //瀹氫箟瑙嗛鎴浘
            private var pic_width:int;
            private var pic_height:int;
            //[Bindable]
            private var m_pictureData:String;
           
            private function initApp():void
            {
                t_btn_Shooting.enabled = false;
                t_ban_Save.enabled = false;
                initCamera();
               pic_height=m_camera.height;
               pic_width=m_camera.width;
            }
           
            //鍒濆鍖栨憚鍍忓ご
            private function initCamera():void
            {
                m_camera = Camera.getCamera();
                if(m_camera != null)
                {
                    m_camera.addEventListener(StatusEvent.STATUS,__onCameraStatusHandler);
                   
                    m_camera.setMode(DEFAULT_CAMERA_WIDTH,DEFAULT_CAMERA_HEIGHT,30);
                    m_localVideo = new Video();
m_localVideo.width = DEFAULT_CAMERA_WIDTH;
m_localVideo.height = DEFAULT_CAMERA_HEIGHT;              t_vd_Video.addChild(m_localVideo); Alert.show("娌℃湁铓狠韌鎽勫垚澶达纴鄄惁Read嶆嶊韊镆ユ瀊銆?quot;,"鎻愮ず锛?quot;,Alert.OK|Alert.NO,this, __InitCamera);
                                                                                                    挳浜嬩愿甛僃繘琛囃棰戞埅锲?br />                                                              ():void
                                                                                                                                                                                                                                atrix());
                                                                              m_pictureBitmapData);
t_img_Picture.addChild(m_pictureBitmap);

t_panel_Picture.visible = true;
t_ban_Save.enabled = true;
}
}
夐挳浜嬩唛屼婛樿棰戞埅锲?br />                                                                                                                                                                                              » >                m_pictureData = "";
                                                                                                         🎜> for(var i:int = 0; i < DEFAULT_CAMERA_WIDTH; i++)
                                                                    🎜> if(m_pictureData.length > 0)
                                                                                                                     m_pictureData += "," + m_pictureBitmapData.getPixel(i,j).toString();
                        }
                        else
                        {
                            m_pictureData = m_pictureBitmapData.getPixel(i,j).toString();
                        }
                    }
                }
                service.getOperation("createjpeg").send(pic_width,pic_height,m_pictureData);
               // t_ws_SavePicture.SavePicture.send();
              
            }
            internal function faultHandler(evt:FaultEvent):void{
   //labelresult.text="error";
   CursorManager.removeBusyCursor();
   Alert.show("淇濆瓨鍑洪敊","鎻愮ず",Alert.YES,this);
   
  }
  internal function createImage(evt:ResultEvent):void{
      //dg_article.dataProvider=evt.result; 
      CursorManager.removeBusyCursor();
   Alert.show("淇濆瓨鎴愬姛","鎻愮ず",Alert.YES,this);
   var date:Date=new Date();
   this.left.headerphoto.source="http://www.tiyi88.com/image/header/0.jpg?id="+date.getMilliseconds();
  }
            //妫€娴嬫憚鍍忓ご鏉冮檺浜嬩欢
            private function __onCameraStatusHandler(event:StatusEvent):void
            {
                if(!m_camera.muted)
                {
                    t_btn_Shooting.enabled = true;
                }
                else
                {
                    Alert.show("鏃犳硶閾炬帴鍒版椿鍔ㄦ憚鍍忓ご锛屾槸鍚﹂噸鏂版娴嬨€?quot;,"鎻愮ず锛?quot;,Alert.OK|Alert.NO,this,__InitCamera);
                }
                m_camera.removeEventListener(StatusEvent.STATUS,__onCameraStatusHandler);
            }
           
            //褰撴憚鍍忓ご涓嶅瓨鍦紝鎴栬繛鎺ヤ笉姝e父鏃堕噸鏂拌幏鍙?br />            private function __InitCamera(event:CloseEvent):void
            {
                if(event.detail == Alert.OK)
                {
                    initApp();
                }
            }
        ]]>
   

                  source="image" destination="amfphp">
  
  
  

 
 

 
 
 
 
       
       
           
       

   

   
       
       
           
       
   

缁樺埗澶村儚鏂囦欢:

class Image{
 
 public function createjpeg($width,$height,$bitmap_data)
 {
  $img=imagecreatetruecolor($width,$height);
  $m_tempPics=explode(',',$bitmap_data);
   for ($i = 0; $i < $width; $i++)
            {
                for ($j = 0; $j < $height; $j++)
                {
                    $pic_argb =(int) $m_tempPics[$i * $height + $j];
                    imagesetpixel($img,$i,$j,$pic_argb);
                }
            }
        imagejpeg($img,"../../image/header/0.jpg");
        imagedestroy($img);
        return true;
 }
}
?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445130.htmlTechArticleflex+php鍦ㄧ嚎鎷嶇収 ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout=absolute width=100% xmlns:ns1=* backgroundGradientColors=[#ecf9f...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn