Hi,
what is synchronous and asynchronous call in flex. Why Httpservice is asynchronous and how to make a call to asynchronous call.
Thanks, Ravi
Hi,
what is synchronous and asynchronous call in flex. Why Httpservice is asynchronous and how to make a call to asynchronous call.
Thanks, Ravi
All remote calls are asynchronous in FlashPlayer. Adobe Virtual Machine 2 doesn't support multi-threading to do any call synchronously. Remote call gives you an object (for example AsyncToken) that will dispatch event on result or fault.
With synchronous calls, the UI will be blocked until a response is received. Since there is not threading API exposed to the developer and blocking the UI is not user friendly at all, calls to external sources are asynchronous. This allows the UI to continue running while the call is executing. Events will be dispatched when a result or fault is received.
There is one exception to this rule: in AIR, it is possible to open asynchronous or synchronous connections to a local SQLite database.
How come a network call be asynchronous? I agree from SWF prespective a call to network will be asynchronous but actual network libraries communicating with HttpService/Webservice will always be synchronous. Although they will be dispatching an even once response is received.
So a network call will be syncronous, unless you implement Messaging Service. But from SWF view since it doesnt support multithreaded request, It handles the response when event/fault of completion is triggered by network libraries