Thanks all. I normally use Cairngorm but it's overkill for an application of this size. I will check out the UniversalMind extension though - sounds good.
@Josh - looks cool. Not looking for a sequential loader, but still ... :) @Johannes - yes, an improvement, thanks Thanks for all the feedback. On Tue, Aug 12, 2008 at 4:55 PM, Sefi Ninio <[EMAIL PROTECTED]> wrote: > I agree, Cairngorm is perfect for this, especially when using the > UniversalMind Cairngorm extension. > UM lets you define an array of remote calls (event-command pairs) which can > be sequence or parallel execution, and once all the remote calls are > finished, you get a notification. > Sounds like exactly what you need. > > Lemme know if you need more details, I've spent some time making sense of > how to use it. > > HTH > Sefi > > > On Tue, Aug 12, 2008 at 4:21 PM, DannyT <[EMAIL PROTECTED]> wrote: > >> Very neat, but does this have a variant whereby these calls can be made >> at the same time? Looks like this (as the name suggests) daisy chains the >> calls firing one after the other rather than calling them all and monitoring >> all of the results and notifying when all are successfully called. >> >> Like the impelementation for subsequent result dependent calls though :) >> >> 2008/8/12 Josh McDonald <[EMAIL PROTECTED]> >> >> This is pretty ordinary, and I plan on re-vamping it, but we're >>> planning on open sourcing most of this stuff soon, so you might as well have >>> a look and you can use it as a base for something better: >>> http://www.gfunk007.com/flex/ChainLoader.as >>> >>> Usage example: >>> >>> new ChainLoader(Application.application.spinner, >>> "begin").then( >>> Application.application, "showLoading").then( >>> Singletons.services.returnCentreDao, >>> "getReturnCentre").thenOnSuccess( >>> Singletons.services.vehiclesDao, >>> "getVehiclesPending").thenOnSuccess( >>> Singletons.services.vehiclesDao, >>> "getVehiclesInStock").thenOnSuccess( >>> Singletons.services.vehiclesDao, >>> "getVehiclesInRepair").thenOnSuccess( >>> Singletons.services.tenderDao, >>> "getAllTenders").thenOnSuccess( >>> this, "selectDefaultTender").then( >>> this, "getTenderVehicles").thenOnSuccess( >>> _pollTimer, "start").then( >>> this, "selectReturnCentreCompleted").then( >>> Application.application, "hideLoading").then( >>> Application.application.spinner, "end").go(); >>> >>> Like I said, it's rough don't bother telling me the myriad ways it can be >>> better, I know :) >>> >>> -Josh >>> >>> On Tue, Aug 12, 2008 at 9: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. >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> "Therefore, send not to know For whom the bell tolls. It tolls for thee." >>> >>> :: Josh 'G-Funk' McDonald >>> :: 0437 221 380 :: [EMAIL PROTECTED] >>> >> >> >> >> -- >> http://danny-t.co.uk >> > > >

