I'm not sure to understand this one !
Anyway Michael, aren't viewHelper and viewLocator not to be used anymore in
cg2 ?
I thought i heard Steven say that everything could now be done using
bindings...
Guess that's another topic :)

-JL

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 23, 2006 5:45 PM
Subject: Re: [flexcoders] Re: Newbie : How do i listen to a value ?
Cairngorm inside.


I'm not sure if this is relevant or not, but the following is response from
Alistair regarding a previous question I had about the use of viewHelpers

-------------------------------------------------------------------------

In your complex value object case, here's what we'd recommend now.

In your command, put the complex object in your model (ModelLocator),
eg.
ModelLocator.getInstance().complextData = theResultFromTheServer;
Now, in your view, you bind to that model item, but call a utility class
to massage the results into the format you want. eg,
<mx:Label text="{ MyUtilityClass.formatDataToSomethingSimpler(
ModelLocator.getInstance().complexData ) }" />
Now, you could possibly call MyUtilityClass a view helper, in the broad
sense of the pattern, but extracting it this way lets you, for example,
unit tests it's functionality and keeps the Model and View separate.

------------------------------------------------------------------------------




             "Jean-Luc ESSER"                  To:
<[email protected]>
             <[EMAIL PROTECTED]>               cc:
             Sent by:                          Subject:  Re: [flexcoders]
Re: Newbie : How do i listen to a value ? Cairngorm
             [email protected]          inside.
             05/23/2006 11:30 AM
             Please respond to
             flexcoders






That's exactly the question Tim, and it has been haunting me for quite a
while now :
1/ Ok, if the view function simply updates the view, fine, using bindings
should do it.
2/ But if it is more complex, i would agree on writing a new command. But
when dispatching an event from any component, it means that the destination

view (where command should execute) should be passed as a parameter. But
that won't scale, imagine you change the destination view name ?!?! So you
could bind the name of the view in the model locator so that if you change
it, you won't have to update each one of your dispatch events.
I don't know which way is the good way...

-JL

----- Original Message -----
From: "Tim Hoff" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 23, 2006 4:45 PM
Subject: [flexcoders] Re: Newbie : How do i listen to a value ? Cairngorm
inside.


Jean-Luc,

You scenario questions make me wonder; when does a function in a
viewHelper or viewLocator (or MXML file) merit becoming a command?
In my opinion, I don't see any reason not to call one command from
another (dispatch or direct call).  For instance getData calls
calculateTotals on result.  Since commands are in the same
abstraction layer, this should be OK.  However crossing layers by
calling a view function from a command should be avoided.

What does the view function actually do.  If it updates the view,
then you can rework this to have your command update state variables
or VO's in the ModelLocator that are bound to the view. This will
automatically update the view.  If the function does anything else,
perhaps the function should become a command.  This was my thought
process when addressing similar issues.  I would love to hear what
Steven and/or Ali have to say about this.

Regards,
Tim Hoff


--- In [email protected], "Jean-Luc ESSER" <[EMAIL PROTECTED]> wrote:
>
> How do i "listen" to a value change in a var ?
>
> Let's say i have a component CompA.
> In this component is a function FunctionA which needs to be
triggered when an event is dispatched from a component CompB.
> Using Cairngorm, i dispatch an event from CompB, running a Command.
> For now, i trigger FunctionA from the Command (ie
Application.application.CompA.FunctionA(myObject) ).
> But that is not how Cairngorm is supposed to work, right ?
> The way i should do it, i guess, is by updating a var myVar to
myObject in my ModelLocator from my Command.
> Then, via bindings, in CompA, listen to myVar, and when changing
to myObject, trigger FunctionA.
>
> Am i right ?
> But how would i do this ?
>
> Help is welcome.
>
> -Jean-Luc
>








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links












--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links










---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to