3 Replies Latest reply on Sep 10, 2008 2:49 PM by @logg57

    popUp : HTTPService

    @logg57
      Hello,

      The variable data typed as String I passed to my popUp has a strange behaviour. I can display my data in a Label text for example, but I can not use the same data in my HTTPService request, the type seems to be erroneous during the request.

      ************************************************************
      The data come from an AdvancedDataGrid :
      public var id_lot:String;
      id_lot=myADG.selectedItem.id_lot;

      ************************************************************
      Then I create my popUp instance and I parse the variables I need to parse, title and id_lot:

      public function relancePopUpBuilder(id_lot:String,title:String):void{
      var popupShowRelance:IFlexDisplayObject= PopUpManager.createPopUp(this,CCApopupRelance,true);
      PopUpManager.centerPopUp(popupShowRelance);
      CCApopupRelance(popupShowRelance).title=title;
      CCApopupRelance(popupShowRelance).id_lot=id_lot;
      }
      public function showRelancePopUp():void{

      relancePopUpBuilder(id_lot,"Relances de la société : "+id_entreprise);
      }

      ************************************************************
      In my PopUp whose base component is a TitleWindow, i define my variable id_lot data typed as String
      Bindable]
      public var id_lot:String;

      and then I can call it correctly in a Label for example
      <mx:Label text="{id_lot}"/>

      ************************************************************
      BUT, i can not use the same data in a HTTPService request like that:

      <mx:HTTPService id="beRPC" result="populateADG(event)" method="POST"
      url="populateAdgRelanceBEXML.php"
      useProxy="false" >
      <mx:request xmlns="">
      <id_lot>{id_lot}</id_lot>
      </mx:request>
      </mx:HTTPService>

      ************************************************************
      In my PHP file,I asign the data passed from Flex to variables and I made a request in a table
      $id_lot = mysql_real_escape_string($_POST["id_lot"]);

      BUT the request doesn't work.



      Thank you if you can advise me something,
      Best regards,
      亚历山大
        • 1. Re: popUp : HTTPService
          @logg57 Level 1
          So strange : I think this phenomenon need one explanation : in my HTTPService request

          <mx:request>
          <id_lot>{id_lot}</id_lot>
          </mx:request>

          id_lot is an ActionScript variable, so why I don"t need the { }??

          because it works like that :

          <mx:request>
          <id_lot>id_lot</id_lot>
          </mx:request>

          Best regards to the readers,
          亚历山大

          • 2. Re: popUp : HTTPService
            ntsiii Level 3
            Since debugging binding like this so hard:
            <id_lot>{id_lot}</id_lot>

            I advise you do not create the request object, declaratively, but rather do it in AS. First remove the mx:request node from the HTTPService tag. Then:

            private function getData():void {
            var oRequest:Object = {id_lot:id_lot};
            trace("id_lot=" + oRequest.id_lot); //do you have the correct string?
            beRPC.send(oRequest);
            ...

            Tracy
            • 3. popUp : HTTPService
              @logg57 Level 1
              Thank you Tracy, I was just searching how to create the request in AS..;)
              And I tryed to parse an ArrayCollection (having made the request in the parent)... in vain because of the request.

              --> I typed my variable id_lot as an integer
              --> I can always print it in a label
              -->BUT the trace of the object gives 0
              I think that the data parsed to the popup can just be read by a mxml syntax, impossible to get in in AS at the time of the creationComplete of my TitleWindow.

              亚历山大