首頁  >  文章  >  後端開發  >  flex+php鍦ㄧ嚎鎷嶇収浜宊PHP鏁欑▼ | 甯涔嬪

flex+php鍦ㄧ嚎鎷嶇収浜宊PHP鏁欑▼ | 甯涔嬪

WBOY
WBOY原創
2016-07-20 11:05:291081瀏覽

flex+php鍦ㄧ嚎鎷嶇収



 
    <script><br>                    import mx.events.CloseEvent;<br>            import mx.rpc.events.FaultEvent;<br>            import mx.rpc.events.ResultEvent;<br>            import mx.controls.Alert;<br>             import mx.managers.CursorManager;<br>            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鍦板潃<br>            <br>            private var m_camera:Camera; //瀹氫箟涓€涓憚鍍忓ご<br>            private var m_localVideo:Video; //瀹氫箟涓€涓湰鍦拌棰?br />            private var m_pictureBitmapData:BitmapData //瀹氫箟瑙嗛鎴浘<br>            private var pic_width:int;<br>            private var pic_height:int;<br>            //[Bindable]<br>            private var m_pictureData:String;<br>            <br>            private function initApp():void<br>            {<br>                t_btn_Shooting.enabled = false;<br>                t_ban_Save.enabled = false;<br>                initCamera();<br>               pic_height=m_camera.height;<br>               pic_width=m_camera.width;<br>            }<br>            <br>            //鍒濆鍖栨憚鍍忓ご<br>            private function initCamera():void<br>            {<br>                m_camera = Camera.getCamera();<br>                if(m_camera != null)<br>                {<br>                    m_camera.addEventListener(StatusEvent.STATUS,__onCameraStatusHandler);<br>                    <br>                    m_camera.setMode(DEFAULT_CAMERA_WIDTH,DEFAULT_CAMERA_HEIGHT,30);<br>                    m_localVideo = new Video();<br>                    m_localVideo.width = DEFAULT_CAMERA_WIDTH;<br>                    m_localVideo.height = DEFAULT_CAMERA_HEIGHT;<br>                    m_localVideo.attachCamera(m_camera);<br>                    t_vd_Video.addChild(m_localVideo);<br>                }<br>                else<br>                {<br>                    Alert.show("娌℃湁鎵惧埌鎽勫儚澶达紝鏄惁閲嶆柊鏌ユ壘銆?quot;,"鎻愮ず锛?quot;,Alert.OK|Alert.NO,this,__InitCamera);<br>                    return;<br>                }<br>            }<br>            <br>            //鎷嶇収鎸夐挳浜嬩欢锛岃繘琛岃棰戞埅鍥?br />            private function SnapshotPicture():void<br>            {<br>                m_pictureBitmapData = new BitmapData(DEFAULT_CAMERA_WIDTH,DEFAULT_CAMERA_HEIGHT);<br>                m_pictureBitmapData.draw(t_vd_Video,new Matrix());<br>                <br>                var m_pictureBitmap:Bitmap = new Bitmap(m_pictureBitmapData);<br>                t_img_Picture.addChild(m_pictureBitmap);<br>                <br>                t_panel_Picture.visible = true;<br>                t_ban_Save.enabled = true;<br>            }<br>            <br>            //淇濆瓨鎸夐挳浜嬩欢锛屼繚瀛樿棰戞埅鍥?br />            //閫氳繃WebService淇濆瓨<br>            private function SavePicture():void<br>            {<br>                m_pictureData = "";<br>                //m_pictureBitmapData.setPixel(1,1,6558750);<br>                //label1.text=m_pictureBitmapData.getPixel(1,1).toString();<br>                <br>                for(var i:int = 0; i                 {<br>                    for(var j:int = 0; j                     {<br>                        if(m_pictureData.length > 0)<br>                        {<br>                            m_pictureData += "," + m_pictureBitmapData.getPixel(i,j).toString();<br>                        }<br>                        else<br>                        {<br>                            m_pictureData = m_pictureBitmapData.getPixel(i,j).toString();<br>                        }<br>                    }<br>                }<br>                service.getOperation("createjpeg").send(pic_width,pic_height,m_pictureData);<br>               // t_ws_SavePicture.SavePicture.send();<br>               <br>            }<br>            internal function faultHandler(evt:FaultEvent):void{<br>   //labelresult.text="error";<br>   CursorManager.removeBusyCursor();<br>   Alert.show("淇濆瓨鍑洪敊","鎻愮ず",Alert.YES,this);<br>   <br>  }<br>  internal function createImage(evt:ResultEvent):void{<br>      //dg_article.dataProvider=evt.result; <br>      CursorManager.removeBusyCursor();<br>   Alert.show("淇濆瓨鎴愬姛","鎻愮ず",Alert.YES,this);<br>   var date:Date=new Date();<br>   this.left.headerphoto.source="http://www.tiyi88.com/image/header/0.jpg?id="+date.getMilliseconds();<br>  }<br>            //妫€娴嬫憚鍍忓ご鏉冮檺浜嬩欢<br>            private function __onCameraStatusHandler(event:StatusEvent):void<br>            {<br>                if(!m_camera.muted)<br>                {<br>                    t_btn_Shooting.enabled = true;<br>                }<br>                else<br>                {<br>                    Alert.show("鏃犳硶閾炬帴鍒版椿鍔ㄦ憚鍍忓ご锛屾槸鍚﹂噸鏂版娴嬨€?quot;,"鎻愮ず锛?quot;,Alert.OK|Alert.NO,this,__InitCamera);<br>                }<br>                m_camera.removeEventListener(StatusEvent.STATUS,__onCameraStatusHandler);<br>            }<br>            <br>            //褰撴憚鍍忓ご涓嶅瓨鍦紝鎴栬繛鎺ヤ笉姝e父鏃堕噸鏂拌幏鍙?br />            private function __InitCamera(event:CloseEvent):void<br>            {<br>                if(event.detail == Alert.OK)<br>                {<br>                    initApp();<br>                }<br>            }<br>        ]]><br>    </script>
                  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             {
                for ($j = 0; $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...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn