7 Replies Latest reply on Sep 21, 2009 1:19 AM by Revlex

    HTTPService.send doesnt send anny data

    Revlex Level 1

      Hi all,

       

      I have a serious problem when my application is online, i cant send anny data with HTTPService.send command. but when locally it does.

      When i click the button tho send the data it doesnt even try to connect here is my code and i cant find the problem. I hope some one can point me in the right direction

      here's my code:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application
          xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/halo"
          minWidth="700" minHeight="715" width="700" height="715"
          xmlns:upload="services.upload.*"
          creationComplete="initVars()"
          >

       

      protected function btn_publish_clickHandler(event:MouseEvent):void
                  {

                     var idioot:int = 1;
                      var text_veld:String = new String();
                      text_veld = tekst_stuk.text

       

                                                 
                                                  obj.user = idioot;
                                                  obj.titel = titel.text;
                                                  obj.keywords = zoek_data.text;
                                                  obj.text = tekst_stuk.text;                                           
                                                  if(voor_geld.text != null)
                                                  {
                                                      obj.price_off = voor_geld.text + "." + voor_geld_cent.text;
                                                  }
                                                  else if(korting_input.text != null)
                                                  {
                                                      obj.price_off = korting_input.text;
                                                  }
                                                 
                                                  if(korting_radio.selected == true)
                                                  {
                                                      obj.price = geld.text + "." + geld_cent.text;
                                                      obj.price_type = "p";
                                                  }
                                                  else if(gratis_radio.selected == true)
                                                  {
                                                      obj.price = "0";
                                                      obj.price_type = "g";
                                                  }
                                                  else if(van_voor_radio.selected == true)
                                                  {
                                                      obj.price = geld.text + "." + geld_cent.text;
                                                      obj.price_type = "m";
                                                  }
                                                  obj.img_1 = img.source;
                                                  obj.img_2 = img_2.source;
                                                  obj.img_3 = img_3.source;
                                                  obj.img_4 = img_4.source;

       

                  }
                  private function send_data_event(e:Event):void
                  {

                      send_data.send(obj);
                      send_data.showBusyCursor;
                  }

          <fx:Declarations>
              <mx:HTTPService id="send_data" method="POST" url="http://someURL"  resultFormat="text" useProxy="false"/>
          </fx:Declarations>

       

      <mx:Image x="525" y="559" source="buttonpubliceren.png" width="150" height="30" id="btn_publish" click="btn_publish_clickHandler(event);" />

        • 1. Re: HTTPService.send doesnt send anny data
          Madhav Subedi Level 4

          so, in your code, when does the function

           

          private function send_data_event(e:Event):void

           

          execute?

          1 person found this helpful
          • 2. Re: HTTPService.send doesnt send anny data
            Revlex Level 1

            The function executes when hij press the Image button:

             

            the new code:

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application
                xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/halo"
                minWidth="700" minHeight="715" width="700" height="715"
                xmlns:upload="services.upload.*"
                creationComplete="initVars()"
                >

             

            protected function btn_publish_clickHandler(event:MouseEvent):void
                        {

                           var idioot:int = 1;
                            var text_veld:String = new String();
                            text_veld = tekst_stuk.text

             

                                                       
                                                        obj.user = idioot;
                                                        obj.titel = titel.text;
                                                        obj.keywords = zoek_data.text;
                                                        obj.text = tekst_stuk.text;                                           
                                                        if(voor_geld.text != null)
                                                        {
                                                            obj.price_off = voor_geld.text + "." + voor_geld_cent.text;
                                                        }
                                                        else if(korting_input.text != null)
                                                        {
                                                            obj.price_off = korting_input.text;
                                                        }
                                                       
                                                        if(korting_radio.selected == true)
                                                        {
                                                            obj.price = geld.text + "." + geld_cent.text;
                                                            obj.price_type = "p";
                                                        }
                                                        else if(gratis_radio.selected == true)
                                                        {
                                                            obj.price = "0";
                                                            obj.price_type = "g";
                                                        }
                                                        else if(van_voor_radio.selected == true)
                                                        {
                                                            obj.price = geld.text + "." + geld_cent.text;
                                                            obj.price_type = "m";
                                                        }
                                                        obj.img_1 = img.source;
                                                        obj.img_2 = img_2.source;
                                                        obj.img_3 = img_3.source;
                                                        obj.img_4 = img_4.source;

                                                       send_data.send(obj);
                                                       send_data.showBusyCursor

             

                        }

             

                <fx:Declarations>
                    <mx:HTTPService id="send_data" method="POST" url="http://someURL" resultFormat="text" useProxy="false"/>
                </fx:Declarations>

             

            <mx:Image x="525" y="559" source="buttonpubliceren.png" width="150" height="30" id="btn_publish" click="btn_publish_clickHandler(event);" />

            • 3. Re: HTTPService.send doesnt send anny data
              Madhav Subedi Level 4

              i cannot see any particular reason behind this.

              i think you should track it with tracing the object before sending as the parameter.

              1 person found this helpful
              • 4. Re: HTTPService.send doesnt send anny data
                Revlex Level 1

                Whell when i use my trace function and alert it onley show [object] so it aint empty. Now im really getting stuck here

                • 5. Re: HTTPService.send doesnt send anny data
                  Madhav Subedi Level 4

                  try to trace all the properties of objects.

                  • 6. Re: HTTPService.send doesnt send anny data
                    Revlex Level 1

                    When i start a new project and i want to connect to PHP i say the web root is someting and the url is something to, could it be that i need to change the url to the site where it is going to be hosted on in stead of localhost?

                    • 7. Re: HTTPService.send doesnt send anny data
                      Revlex Level 1

                      When i tace the stuff evreyting has his information