Leo Vildosola
11-11-2003, 08:15 PM
Flash remoting is asynchronous by nature. In order for a flash client to process results it is required to write two callback functions per service call or simply an onResult method for handling returned values and an onStatus method for error handling.
I don't want to have to create these methods all the time, so I created a base class in AS2 to support any service consumer. The class is called AbstractServiceConsumer. In this class I have onResult and onStatus methods to deal with the information being returned as a result of the remote call. I also have a property that stores the returned value for the last call onResult handled.
My goal is to create a layer over flash remoting that will allow me to simulate a synchronous call. I basically would like to make the service call, wait until the onResult is called, and access the property to get the value.
Eveything works fine until I have to wait for the onResult call. The problem I have is that I don't know how to force a wait or sleep of the current processing. I can't find any functionality that will allow me to do just that. I have looked into setInterval but I don't think it does what I need since it continues processing after the function is called.
I don't want to have to create these methods all the time, so I created a base class in AS2 to support any service consumer. The class is called AbstractServiceConsumer. In this class I have onResult and onStatus methods to deal with the information being returned as a result of the remote call. I also have a property that stores the returned value for the last call onResult handled.
My goal is to create a layer over flash remoting that will allow me to simulate a synchronous call. I basically would like to make the service call, wait until the onResult is called, and access the property to get the value.
Eveything works fine until I have to wait for the onResult call. The problem I have is that I don't know how to force a wait or sleep of the current processing. I can't find any functionality that will allow me to do just that. I have looked into setInterval but I don't think it does what I need since it continues processing after the function is called.