flex + php

Jul 20, 2016 am 11:05 AM
encoding xml

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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1673
14
PHP Tutorial
1278
29
C# Tutorial
1257
24
Can I open an XML file using PowerPoint? Can I open an XML file using PowerPoint? Feb 19, 2024 pm 09:06 PM

Can XML files be opened with PPT? XML, Extensible Markup Language (Extensible Markup Language), is a universal markup language that is widely used in data exchange and data storage. Compared with HTML, XML is more flexible and can define its own tags and data structures, making the storage and exchange of data more convenient and unified. PPT, or PowerPoint, is a software developed by Microsoft for creating presentations. It provides a comprehensive way of

Convert XML data to CSV format in Python Convert XML data to CSV format in Python Aug 11, 2023 pm 07:41 PM

Convert XML data in Python to CSV format XML (ExtensibleMarkupLanguage) is an extensible markup language commonly used for data storage and transmission. CSV (CommaSeparatedValues) is a comma-delimited text file format commonly used for data import and export. When processing data, sometimes it is necessary to convert XML data to CSV format for easy analysis and processing. Python is a powerful

Handling errors and exceptions in XML using Python Handling errors and exceptions in XML using Python Aug 08, 2023 pm 12:25 PM

Handling Errors and Exceptions in XML Using Python XML is a commonly used data format used to store and represent structured data. When we use Python to process XML, sometimes we may encounter some errors and exceptions. In this article, I will introduce how to use Python to handle errors and exceptions in XML, and provide some sample code for reference. Use try-except statement to catch XML parsing errors When we use Python to parse XML, sometimes we may encounter some

Python implements conversion between XML and JSON Python implements conversion between XML and JSON Aug 07, 2023 pm 07:10 PM

Python implements conversion between XML and JSON Introduction: In the daily development process, we often need to convert data between different formats. XML and JSON are common data exchange formats. In Python, we can use various libraries to convert between XML and JSON. This article will introduce several commonly used methods, with code examples. 1. To convert XML to JSON in Python, we can use the xml.etree.ElementTree module

Python parsing special characters and escape sequences in XML Python parsing special characters and escape sequences in XML Aug 08, 2023 pm 12:46 PM

Python parses special characters and escape sequences in XML XML (eXtensibleMarkupLanguage) is a commonly used data exchange format used to transfer and store data between different systems. When processing XML files, you often encounter situations that contain special characters and escape sequences, which may cause parsing errors or misinterpretation of the data. Therefore, when parsing XML files using Python, we need to understand how to handle these special characters and escape sequences. 1. Special characters and

How to handle XML and JSON data formats in C# development How to handle XML and JSON data formats in C# development Oct 09, 2023 pm 06:15 PM

How to handle XML and JSON data formats in C# development requires specific code examples. In modern software development, XML and JSON are two widely used data formats. XML (Extensible Markup Language) is a markup language used to store and transmit data, while JSON (JavaScript Object Notation) is a lightweight data exchange format. In C# development, we often need to process and operate XML and JSON data. This article will focus on how to use C# to process these two data formats, and attach

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

How to use PHP functions to process XML data? How to use PHP functions to process XML data? May 05, 2024 am 09:15 AM

Use PHPXML functions to process XML data: Parse XML data: simplexml_load_file() and simplexml_load_string() load XML files or strings. Access XML data: Use the properties and methods of the SimpleXML object to obtain element names, attribute values, and subelements. Modify XML data: add new elements and attributes using the addChild() and addAttribute() methods. Serialized XML data: The asXML() method converts a SimpleXML object into an XML string. Practical example: parse product feed XML, extract product information, transform and store it into a database.

See all articles