| 1. |
How Do I Make Synchronous Data Calls In Actionscript? |
|
Answer» You cannot make synchronous calls. You must use the result event. No, you can't use a loop, setInterval, or even doLater. This paradigm is quite aggravating at first. Take a DEEP breath, surrender to the inevitable, RESISTANCE is futile. There is a generic way to handle the asynchronous nature of data service calls, CALLED ACT (Asynchronous CALL Token). Search for this in the Developing Flex Applications LiveDocs for a full description. Here it is in a nutshell. This example uses HTTPService but will be similar for RemoteObject and WebService:
//invokes the call to the HTTP data service
var callResponse = oEvent.call; //get the call object You cannot make synchronous calls. You must use the result event. No, you can't use a loop, setInterval, or even doLater. This paradigm is quite aggravating at first. Take a deep breath, surrender to the inevitable, resistance is futile. There is a generic way to handle the asynchronous nature of data service calls, called ACT (Asynchronous Call Token). Search for this in the Developing Flex Applications LiveDocs for a full description. Here it is in a nutshell. This example uses HTTPService but will be similar for RemoteObject and WebService: //invokes the call to the HTTP data service var callResponse = oEvent.call; //get the call object |
|