Select to view content in your preferred language

dojo.deferred equivalent

766
3
12-28-2011 06:24 PM
HaroldBostic
Frequent Contributor
Hello, I feel like I'm missing something blatantly obvious, but does anybody know what the equivalent of a dojo deferred object is in FLEX.  Basically, I have multiple different async calls and want to know when they are all complete so I can process their results collectively together.

Any ideas would be greatly appreciated
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Harold,

   The way I normally handle this is to have each returned async process set a unique boolean var and at the same time check if all the other boolean vars are true. If all are true then execute a final function. Someone out there may know of a better way though.
0 Kudos
AndyGup
Esri Regular Contributor
To add to Robert's comments. I've also used a global ArrayCollection that keeps track of each request token. Then with each response I check the ArrayCollection to see if all the tokens have come back.

I've had a couple requests related how to do an asynchronous (tokenized) HTTP request in Flex, so here's a link to a blog post: http://blog.andygup.net/?p=460

-Andy
Esri Developer Network
0 Kudos
DanielSmith
Frequent Contributor
Hello,

I am trying to auto-populate a couple area attributes after editing with the flex viewer (Acres and Sq Km). Since the areas need to be as accurate as possible i am projecting the geometry before sending it to the areasAndLengths() function.

The problem i am having is i do not seems to be able to wait for the second Async response from the areasAndLengths() function to complete. I set up both the project result handler and the areasAndLengths result handler to return a boolean value as recommended but my application times out when waiting for the areasAndLengths to complete.

I am calling the project function from the selection complete function as recommended in previous post here (http://forums.arcgis.com/threads/23497-EditTool-Autopopulate-Fields?highlight=autopopulate) and using the area and length code from the samples.

Any suggestions or code samples to test if both have functions have completed are greatly appreciated.

Considering an SOE or GP task but that seems to be overkill since these are both capabilities of the server in already.

Thank you very much for your time and any assistance, as always i am happy to promote any helpful answers .
0 Kudos