0 Replies Latest reply on Apr 26, 2007 12:58 AM by TigerArt

    ActionScript 3 RemoteObject

    TigerArt Level 1
      I created RemoteObject and I'm using AMFPHP.
      It d'oens't return a result

      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      import donnees.Projet;
      import mx.rpc.remoting.mxml.Operation;
      import mx.rpc.remoting.mxml.RemoteObject;

      public var remoting:RemoteObject = new RemoteObject;
      public var op:Operation = new Operation(remoting, "charger");
      public var proj:Projet = new Projet();

      public function init():void
      {
      op.addEventListener(ResultEvent.RESULT, onResultat);
      remoting.showBusyCursor = true;
      remoting.source = "gestionnaire.GestionnaireProjets";
      remoting.destination = "amfphp";
      proj.date_debut_projet = new Date(2000, 02, 1);
      proj.date_fin_projet = new Date(2007, 05, 05);
      proj.date_modification = new Date(2008, 06, 05);
      proj.description_projet = "hello moto";
      proj.id_projet = 1;
      proj.nom_projet = "nom";
      proj.type_projet = "cd site";
      //op.arguments = proj;
      op.arguments = "hi";
      remoting.getOperation('charger').send();
      }

      private function onResultat(event:ResultEvent):void
      {
      remoting.showBusyCursor = false;
      btn.label = ( "result =" + event.toString());//.message.toString();//.body.toString();
      mx.controls.Alert.show(event.toString());
      }
      ]]>
      </mx:Script>

      btn here is a button

      and my php function is
      public function charger($projet)
      {
      return $projet;
      }