Flex and PHP Communication (screenshot, online preview, source code download)

Source: Internet
Author: User

Flex vs. PHP Communication preview

Online Preview Address: http://rj.8634.com/xiaoshandong/flexandphp/FlexApplication3.html

Code download address:http://rj.8634.com/xiaoshandong/flexandphp/FlexApplication3.zip

Description: PHP files should be copied to the root directory for use, Visual Studio will need to install the Amethyst plugin (development flex).

"Flex and PHP Communication" development

"Flex and PHP communication" source code

Flexapplication3.mxml

<?XML version= "1.0" encoding= "Utf-8"?><s:applicationHeight= "All"width= "$"Xmlns:fx= "http://ns.adobe.com/mxml/2009"xmlns:s= "Library://ns.adobe.com/flex/spark"xmlns:mx= "Library://ns.adobe.com/flex/mx"Click= "Application_click (event)">  <Fx:scriptSource= "FlexApplication3.designer.as"/>    <S:buttonID= "Button2"Height= "All"width= "117"label= "Get"x= " the"y= "173"name= "button"Click= "button2_click (event)"/>    <S:textareaID= "text"Height= "The "width= "307"x= "+"y= "the"name= "TextArea"/>    <S:labelID= "Label1"Height= "+"width= "143"text= "Data returned on the server"x= "The "y= " the"name= "Label"/></s:application>

FlexApplication3.designer.as

////Amethyst Designer file for Flexapplication3.mxml//ImportFlash.accessibility.*;ImportFlash.debugger.*;ImportFlash.display.*;Importflash.errors.*;Importflash.events.*;ImportFlash.external.*;Importflash.filters.*;Importflash.geom.*;ImportFlash.media.*;Importflash.net.*;Importflash.printing.*;ImportFlash.profiler.*;Importflash.system.*;Importflash.text.*;Importflash.ui.*;Importflash.utils.*;ImportFlash.xml.*;Importmx.events.*;ImportMx.controls.Alert;Importspark.effects.easing.EaseInOutBase;//urlrequest a request link containing a URLPrivate varUrlrequest:urlrequest =NewURLRequest ("http://rj.8634.com/getIp.php");//urlvariables storing parameter dataPrivate varUrlvariables:urlvariables =Newurlvariables ();//request must be on loader to startPrivate varUrlloader:urlloader =NewURLLoader (); [Amethystdelegate ("Application_click")]Private functionApplication_click (event:flash.events.MouseEvent):void {    }//Get PHP DataPrivate functionCallphp ():void{urlvariables.message="Hello"; Urlrequest.data=Urlvariables; Urlrequest.method=Urlrequestmethod.post;    Urlloader.addeventlistener (Event.complete, ChangeValue); Urlloader.load (urlrequest);}Private functionChangeValue (event:event) {Text.text=Urlloader.data;} [Amethystdelegate ("Button2_Click")]Private functionButton2_Click (event:flash.events.MouseEvent):void{callphp ();}

PHP Background Code

<? PHP   $para $_post [' message '];   Echo $para. ' ‘. $_server [' REMOTE_ADDR '];? >

Flex and PHP communication (, online preview, source code download)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.