PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: jfdesgagne on February 11, 2009, 02:21:23



Title: Proxy and data Bindable
Post by: jfdesgagne on February 11, 2009, 02:21:23
Hi. I have a problem with PureMVC and data bindable.

I register a proxy who load text on 2 differents resources. It have a public bindable function in the Proxy class who call the getString bindable function of ResourceManager. My function is bindable on the "change" event, same as the getString function in the ResourceManager.   [Bindable("change")]

Normaly in each mxml, there are a reference of the ResourceManager ... so I can easy use bindable data like {resourceManager.getString("en_US", "myKey")}

But if i want to use the bindable function in the proxy, it does'nt work ... i presume its because it's a static reference of a bindable function ...
{LocaleProxy.getInstance().getString("en_US", "myKey")}

Anyone have a clue because i'm lost !

Thanks


Title: Re: Proxy and data Bindable
Post by: puremvc on February 12, 2009, 07:58:56
Bindable isn't working on your proxy methods because Proxy isn't an EventDispatcher subclass. Proxies communicate changes to the rest of the system by Notification, not Events. We are trying to separate the model from the view, so rather than binding a view component directly to a Proxy to get updates, we have Mediators which respond to the notifications sent by the proxy and update the view accordingly.

The Proxy recieves updates from the view via mediators listening to the view components events, then sending the changed data in a notification picke d up by a command that modifies the model, or the mediator may do simple updates directly to the model on behalf of the view component.

The process is essentially the same as what happens under the hood with Flex binding, except, being built into the framework, it is portable to places where Flex binding isn't available, such as flash.

-=Cliff>