ServiceFacade.getInstance().loadCats(); public function loadCats():void { var handlers : IResponder = new mx.rpc.Responder(onResults_loadCatalog,fault); getDelegate(handlers).loadCatalog(); }
Looks like a terrible solution. I agree with your comments regarding the Controller and Commands but replacing them with a singleton that defines all your applications responder methods doesn't seem very manageable. --- In flexcoders@yahoogroups.com, "michniu" <[EMAIL PROTECTED]> wrote: > > Hi Coders, > > I just want to discuss some issues about the Cairgorm, Because I > cant find another maillist or forum to discuss it. I put it here. > > > The most uselees part in cairgorm ----frontCotroller and command > > > Just my on opionion, I really dont like to write the command for > every action and register it on frontcoutroller. I really think it > waste time, and It make debuging difficult! Sometimes you dont know > where do you get the result after you dispathce your Event. > > > > Use A ServiceFacade to replace the frontcontroller and the command. > > I use a ServiceFacade to call the Delegate instead of the > controller and the junk command. > > The idea is when the view page active some action. it will not > dispathc any event . it will call the service mathod from service > facade. > > Here is example code form flexStore: > > /** > * Wrapper function to invoke a call to load the > catalog XML data > * @private > */ > private function onLoadCatalog():void { > var event : LoadCatalogEvent = > new oadCatalogEvent(); > event.dispatch(); > } > > to replace the event dispath() my solution is : > > private function onLoadCatalog():void { > > ServiceFacade.getInstance().loadCats(); > } > > > And Ind ServiceFacade .loadCats() method call teh delegate and > service: > > public function loadCats():void { > var handlers : IResponder = new > mx.rpc.Responder(onResults_loadCatalog,fault); > getDelegate(handlers).loadCatalog(); > } > > > Use this way, I dont need create any frontController and command. > I also get the benefit from Cairgorm ServiceLocate Delegate and > Model locator. > > > Any suggestion or Criticze is Appretiate > > > Mike >