I have an asynchronous proxy (P1) which uses a remote object to retrieve data from php services (using amfphp).
When my mediator (M1) wants to get data for its view, it calls a function (f1) of P1.
This function calls the php service. Response of php service is caught by another function (f2) of P1.
This function puts the result in a public var of the proxy and sends a notification telling that data has been received.
M1 is an observer of this notification and updates data of its view using P1 public var.
I have a new mediator M2 who needs to use the same service with different parameters.
If I use the same mechanism, P1 will send the notification telling that data has been successfully retrieve and both M1 and M2 will update their data.
I don't want M1 to update its view when M2 uses the service and vice versa.
I have thought of two ways to have the behaviour I expect.
First solution.When M1 calls f1 function, P1 uses a private var used to store the 'id' of the requester (M1) of the service.
When f2 receives data, it sends a notification depending on the requester (DATA_FOR_M1_RECEIVED, DATA_FOR_M2_RECEIVED).
Second solution.f1 defines the function listening to the response of the php service depending on the requestor.
I don't like those solutions
It would be much better to define function managing response as parameter of the function calling the service.
I'm looking for good ideas
I'm convinced that experienced users of flex have already found elegant solutions for this problem.