i normally use a hash to manage this kind of thing. when the responder returns you set the key in the dictionary object's to true, false or error object, and you loop through all the keys and make your decision from there.
On Tue, Aug 12, 2008 at 1:46 PM, Simon Bailey <[EMAIL PROTECTED]>wrote: > How about defining and array with all the method names and every time a > method is returned it removes its method name from the array. The method to > remove each item from the array would check the array length each times its > called and when the array.length == 0 then call your method x? > > Cheers, > > Simon > ** > newtriks.com <http://www.newtriks.com/> > > On 12 Aug 2008, at 12:37, nwebb wrote: > > > 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. > > > > -- j:pn \\no comment

