5 Replies Latest reply on Feb 9, 2007 2:46 PM by TigerArt

    Flex 2 and AMFPHP

      having looked at Mike Potters example on reading from a MYSQL database http://www.adobe.com/devnet/flex/articles/flex2_amfphp.html

      I was very happy to find a way of using php with flex 2 without having to return the data to flex 2 as xml.

      the only thing with mikes tutorial is that it only shows how to retrieve records ....how would you send data to mysql using this method?

      if there any other examples you may have found or of which would be particularly useful please include.

      another question....is AMFPHP the best way to go devoping flex2 with php or should i just stick with using http service to connect to php/mysql database?

        • 1. Re: Flex 2 and AMFPHP
          africanshox Level 1
          i found the solution and will now try to expand on the tutorial provided my "hasan outume" on http://hasan.otuome.com/

          where he shows how to build a guestbook using flex 2 and amfphp.
          • 2. Re: Flex 2 and AMFPHP
            I'm also trying to update database using Flex2 and AMFPHP.
            Please if someone knows how, give a ink or post the source code here.
            Thank you.
            • 3. Re: Flex 2 and AMFPHP
              TigerArt Level 1
              I found the solution
              here it is

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
              <mx:RemoteObject id="sendservice" fault="faultHandler(event)" showBusyCursor="true" source="tutoriels.DataSender" destination="amfphp">
              <mx:method name="sendData" result="gestionResultat(event)">

              import mx.managers.CursorManager;
              import mx.rpc.events.ResultEvent;
              import mx.rpc.events.FaultEvent;

              private function faultHandler(fault:FaultEvent):void{
              champ.text = "code:\n " + fault.fault.faultCode + "\n\nMessage:\n" + fault.fault.faultString + "\n\nDetail:\n" + fault.fault.faultDetail;

              private function gestionResultat(evenement:ResultEvent):void{
              champ.text = evenement.message.body.toString();
              <mx:VBox horizontalAlign="center" verticalAlign="middle" horizontalCenter="20" verticalCenter="20">
              <mx:TextArea width="400" height="400" id="champ"/>
              <mx:Button label="Envoyer" id="btn" click="sendservice.getOperation('sendData').send()"/>

              class DataSender{
              function sendData($arg1){
              return $arg1.$arg1;
              • 4. Re: Flex 2 and AMFPHP
                ciwee_ufrj Level 1
                it doesn't work because it's Flex Data Services-dependent. You need to have a FDS-ready server (like JRun, Tomcat) and a properly configured web-application.

                AMFPHP runs on ever server that support PHP. Actually HTTPServices are the simplest way to exchange data with the server
                • 5. Re: Flex 2 and AMFPHP
                  TigerArt Level 1
                  Why do you say it doesn't work. It works fine.