2 Replies Latest reply on Apr 28, 2011 10:31 AM by Shravan P

    Can any one help me regarding HTTPService

    Raghuvasa Level 1

      Hi All,

       

              Can any one help me regarding HTTPService

       

      I have a service with id as histogramService and i am adding listener to to this service dynamically in actionscript method like below shown

       

      histogramService.addEventListener(ResultEvent.RESULT,function(event:ResultEvent):void
                   {

                           methodCalling(event);
                     
                  });

       

      Now the problem is the result event is coming two times if i add like above.

       

      The result event coming only one time if i add result to the directly to the service like below shown

       

      <mx:HTTPService id="histogramService" showBusyCursor="true"  useProxy="false" resultFormat="e4x" method="POST" result=" methodCalling(event)"  />

       

      i have to add listener dynamically and i need to get result only once.

       

      Can any one help me regarding this.

       

      Thanks in  advance

      Raghu

        • 1. Re: Can any one help me regarding HTTPService
          EvyatarBH Level 3

          Make sure you call the addEventListener function only once and that you removed the relevant MXML definition (result=" methodCalling(event)").

          • 2. Re: Can any one help me regarding HTTPService
            Shravan P Level 1

            I am bit confused with your code/question.

             

            Hope this below example solves your issue.

             

            private function fillList(src:String):void{

                                histogramService.url = src;
                            histogramService.send();

                      }

             

            private function methodCalling(event:ResultEvent):void {
                           //sample code

                            var xmlList:XMLList = XML(evt.result).images.image;
                            xmlListColl = new XMLListCollection(xmlList);
                        }

            <mx:HTTPService id="histogramService" showBusyCursor="true"

            useProxy="false" resultFormat="e4x" method="POST"

            result=" methodCalling(event)"  />

             

            <mx:Button label="fill"
                            click="fillList('gallery.xml');" />

             

            <mx:TileList id="tileList"
                        dataProvider="{xmlListColl}"

                        columnCount="3"
                        columnWidth="150"
                        rowCount="2"
                        rowHeight="100" />

             

             

             

            -Shravan P.