0 Replies Latest reply on Dec 13, 2007 7:36 AM by Ventis85

    Dynamic HTTPService request AS3

    Ventis85
      I'm doing a mashup in Flex right now using Yahoo Maps. One of the functions allows users to create their own routes.

      Here's the problem. I need a dynamic httpService request because I never know beforehand how many markers a route holds. Here's my code:

      [Bindable]
      private var rssFeed:String;

      private function opslaanRoute(event:Event):void
      {
      if(this.tekstInputVenster.text!="")
      {
      if(markerLijst.length>0)
      {
      rssFeed = "<route>";
      rssFeed += "<routebeschrijving>"+this.tekstInputVenster.text+"</routebeschrijving>";
      var lengte:Number = markerLijst.length;

      for(var d:Number=0;d<lengte;d++)
      {
      rssFeed +="<marker>";
      rssFeed += "<latlon"+d+">"+markerLijst[d][0]+"</latlon"+d+">";
      rssFeed += "<indexMarker"+d+">"+markerLijst[d][1]+"</indexMarker"+d+">";
      rssFeed += "<titel"+d+">"+markerLijst[d][2]+"</titel"+d+">";
      rssFeed += "<beschrijving"+d+">"+markerLijst[d][3]+"</beschrijving"+d+">";
      rssFeed +="</marker>";
      }
      rssFeed += "<aantal>"+indexMarkers+"</aantal>";
      rssFeed += "<userid>"+_loginid+"</userid>";
      rssFeed += "</route>";
      opslaanR.send();
      }
      else
      {
      Alert.show("U moet markers toevoegen om op te slaan!");
      }
      }
      else
      {
      Alert.show("U moet een routebeschrijving toevoegen om op te slaan!");
      }
      }

      The httpservice looks like this:

      <mx:HTTPService
      id="opslaanR"
      url="url"
      useProxy="false"
      method="POST"
      resultFormat="e4x"
      result="opslaanSucces(event)"
      showBusyCursor="true"
      >
      <mx:request>
      {rssFeed}
      </mx:request>
      </mx:HTTPService>

      The "aantal" tag is the number of markers a route holds. Basically I want to loop the $_POST variables in php using "aantal" so I can add them to my database. The PHP works flawlessly but it never gets the httpservice values.

      Please help.