Hi Adriana,

I'm not a native English speaker neither (living in Ukraine), so hope text
below could be parsed as pretty English.

Regarding View to Model communication, it is known how this problem is
solved in some MVC frameworks.

For example, in
PureMVC<http://puremvc.org/component/option,com_wrapper/Itemid,34/>,
Model (who is set of "Proxies" used to work on data) can't be directly
accessed from View (who is set of "Mediators" to work with UI components),
but only through Controller (who is set of stateless "Commands"). Controller
(Commands) can call methods of Proxies (Model) and this is only way for View
to talk to Model -- through Controller.

To launch a Command, which will manipulate Model, View uses "Notification"
-- special and only class used for bringing messages between the M, V and C.
Each Notification can have (or not) body:Object with your Value Object
attached if needed.

Then, as soon as Model gets the data ready, it can notify View back using
Notifications too.

Generally it looks like this:

1. From Model (Proxy) to View (Mediator(s)):

    Model  ---notification([VO])---> View

2. From View to Model (backward):

    View  ---notification([VO])--->  Controller  ----> Model

To send data, you put it in the Notification.body through VO, who holds the
data. And, to keep all this actors under control, Facade is used in PureMVC.

This approach isn't only possible one, but is pretty good for a lot of
situations.


Best regards,
Rost



On Mon, Jun 2, 2008 at 7:25 PM, Adriana Cutnei <[EMAIL PROTECTED]>
wrote:

> Hi there,
>
> I'm Brazilian developer and I work with Flash in USA, so my English it
> isn't the best, please forgive me for that.
>
> I just started to work with pixlab and design pattern, I tried to find the
> answers by myself but it didn't work that well, so, let's see if you can
> give me some directions.
>
> So, my sample test is about 5 buttons that it will be all in the same view
> (ex.: view1.butt0 - view1.butt1 ...etc), when you click one of them I'll
> show the content thats refer to that button in another view (view2 =
> myPrompt).  My plans is to work with these 2 views and one model, where the
> model will process the information (load the proper information from the xml
> file), and give back to both views that information.  The only way that
> worked for me right now is if I define a _global variable and when the user
> press the button, it save there the information of which button was
> pressed.  I read that you generally should NOT be using a _global variable,
> so, How can I make the model identify which button was pressed since Im
> using an event for call that model?  How is the efficient way for to do this
> communication?
>
> Please let me know if I was clear enough and if somebody can give any help
> with information or links about the subject.
>
> Thanks for you help,
>
> Adriana
>
>
>
> _______________________________________________
> osflash mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>


-- 
R
http://flash-ripper.com/
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to