1 Reply Latest reply on Jul 20, 2012 9:18 AM by nikos101

    Remote object help

    jfb00 Level 3

      Hi All,

      I have a method that I need to call multiple times passing parameters.

      what can i do to wait until the method is back with results before I fire the second time?

      Here is my code:

      <fx:Declarations>

              <s:RemoteObject id="SM_RO" destination="ColdFusion" source="{cfcPath}" >

                  <s:method name="getData" result="getData_Handler(event)" fault="error_Handler(event)"/>

           </s:RemoteObject>

      </fx:Declarations>

       

      My calls:

      private function doCalculations():void{

           SM_RO.getData(3, secondID, myArray, myArrayCollection);

           SM_RO.getData(4, secondID, myArray, myArrayCollection);

           SM_RO.getData(8, secondID, myArray, myArrayCollection);

      }

       

      Handler:

      private function getData_Handler(event:ResultEvent):void{

                      acTemp.removeAll();

                      acTemp = ArrayCollection(event.result);

                      acTemp.refresh();

                      acFinalCal.addItem(acTemp[0]);

                      acFinalCal.refresh();

                  }

       

      I know i can create different methods and wait for each method back and fire the next one but I don't want to create separate methods because they have very long code and they are doing the same thing.

      Thanks!