This content has been marked as final. Show 5 replies
you have to redesign your app.
A webservice call is a async operation and the flex framework didn´t capsulate this async operation. (.Net webservice classes provide sync call, but the call itself is still async).
So you have to throw a event (validateListDataEvent) when the webservice call returned. The validateListData function just invoke the webservice call.
The class which calls validateListData can register to your custom validateListDataEvent and in the eventHandler function you can display the outcome however you like it.
Hope this will help you.
thanks for the reply..
that means i need to call my webservice first, and then i use my logic to proceed further?
As i need the result at that step only? i mean within the function flow. As for example i need to call the function to get the value back based on the parameter passed. i.e at each step I am calling my function to get some value(returned by webservice), that value needs to be displayed as an alert. so please suggest some possible solution for dis kind of situation also.
yes, you first have to wait until the webservice returned and than proceed with you logic.
The reason is that the app just use one thread, which can not be blocked, cause otherwise the webservice never will return. (flash didn´t support multiple threading)
I know that this can be very frustating ( I was in a similar situation) and I didn´t found any other solution for this behaviour, so I made my app driven by events.
If anybody has found another solution I would be glad to here it.
Nope, you got it, all data access is asynchronous, and there is no code blocking.
Events are the only way to go.
in your validateListData function go ahead and call the webservice. (via the checkMarketSegment func is fine) But do not try to do anything else in either of those functions.
Declare a resultEvent listener on the WebService or operation, and point it at a function like onResult(). In that function, test your event.result value and continue your logic. (show the Alert, or whtever.)
This IS a PITA if you are used to synchronous operations, but there is no alternative.
thanks all..i changed my logic..and its wrking now..