Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Getting Started / Asynchronous proxy with multiple clients on: November 20, 2009, 12:46:51
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.
2  Announcements and General Discussion / Getting Started / Application Mediator for tabNavigator on: November 17, 2009, 02:10:37
I have seen this post http://forums.puremvc.org/index.php?topic=842.0
and this demo http://puremvc.org/pages/demos/AS3/Demo_AS3_Flex_Slacker/srcview/

I have created an ApplicationMediator listening to my application which has a tabNavigator.

My main application fires and event each time selected tab changes (I use change event of the tabNavigator). Events are SHOW_TAB1, SHOW_TAB2, etc. ApplicationMediator listens to those events.
When SHOW_TABx is fired, ApplicationMediator removes mediators linked to over tabs and registers mediators linked to the one selected.

onRemove method of all my mediators removes listeners linked to the mediator removed.

Is it a good way to manage registration of mediators linked to tabs of a tabNavigator ?
3  Announcements and General Discussion / Architecture / Mediators organization on: November 13, 2009, 10:09:32
Hello, it's my first message here :)

I use PureMVC for my Flex application.
The main mxml application file has three panels in.
Each panel is linked to its mediator.
I already manage states in each panel using their mediators.
I wan't to manage states of my application to remove or add those panels.

To be able to do that, I want to add a container (panel for example) at the top level of my application (containing the three panels) with its own mediator.
This mediator will observe notifications to change the state of the application. I think I will have to manage registration of mediators linked to panels added or removed.

Do you think it's a good idea ?
Pages: [1]