Hi, hoping for some help on this...
*
Problem*:
I am making multiple asynchronous calls to the server and I want to ensure I
have the data back from *all* the calls before calling method x.
I don't want to daisy-chain the calls (i.e.having to wait until service#1
reurns data before calling service#2 and so on).

I have a solution which will suffice* but I'm sure there must be a tried and
tested way of handling this kind of scenario - perhaps a design pattern(?).

-----------------------------------
* my current solution is to declare an ArrayCollection and listen to its
CollectionEvent.COLLECTION_CHANGE event.
In each onResult() method I set* itemsLoaded.addItem(true);* and similarly
in each onFault() method I set *itemsLoaded.addItem(false);*

Each time I add the boolean value to the collection, the change-event
handler is called. Inside the change handler I check to see whether the
collection length is equal to the number of results I'm expecting. If it is,
I loop through the collection and check if all the values are true or not.

Reply via email to