Skip navigation
Currently Being Moderated

Remote object help

Jul 18, 2012 11:29 AM

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!

 
Replies
  • Currently Being Moderated
    Jul 20, 2012 9:18 AM   in reply to jfb00

    Hi jfb!,

     

    Call this once

     

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

     

    and in your handler call it again, keeping track of the times you call it with a field var.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points