Can you share your SearchCommand and SearchDelegate class?
1 person found this helpful
The problem is about resource management. You add listeners without removing them after task done.
In Cairngorm, to handle each dispatched event, FrontController will create a new command of corresponding CommandClass. First time you dispatch the search event, command1 will be generated to execute and listen to ResultEvent as well as FaultEvent, but after all the listeners still remain. Next time you dispatch the search event, command2 will be generated and once again addEventListener to the remoteObject. From now, whenever a fault event happens, both command1 and command2 executes their own event handling functions.
To solve this problem, you can either
_ Call removeEventListeners when the command is no longer needed,
_ Split this command into several subCommand, each command implements IResponder interface and handles one AbstractOperation. Use the following code lines instead of add listeners directly to the Operation
var estOp:AbstractOperation = remoteService.getOperation("getEstimators"); var call:AsyncToken = estOp.send(); call.addResponder( this ); // this here is the subCommand instance, which has result(event) and fault(event) methods
I am working on your suggestion, will get back once done...
Message was edited by: ShankarFlex3
The code works perfectly after the changes.