Thanks for your thoughts on this topic, I am sorry I have not replied
earlier, but my ADSL connection went down yesterday.
I will explain a bit on what I have done. I do use cairngorm. I have a
set of vars in the model, each one specific to one of my data views.
When the parameters change, I set these vars to true, meaning there
has been a change.
model.redisplayPriceData
model.redisplayCreditData
model.redisplayShippingData
Now in my display views, I use the Observer class to react to these
model vars, and when true they call a handler in each view to
re-display the view.
Due to the nature of the Observer, I reset the model vars to false at
the end of the re-display, otherwise, the observer is not triggered in
subsequent parameter changes.
This works well and is quite straight forward to set-up. The downside
is that the parameter screen or the application has to know each view
that relies on the parameters, as the model vars need to be set, e.g.
model.redisplayPriceData = true, model.redisplayCreditData = true
What I would like ideally is that the parameters view fires a series
of events, these are AS events not cairngorm events. Then each display
view can have one or more event listeners that will then react to
specific changes in the parameters.
This way I can add a new display view with its own event listeners,
and I don't need to change any other components. The way I have it now
using an Observer, will entail adding to the model, then changing the
parameters view to set the var.
I tried unsuccessfully to use events. I can fire the event(s) from the
parameter view. But I cannot get an event listener in the data views
to work.
Using my example
TabNavigator
mycomponent1 - Edit parameters
mycomponent2 - Display Price Data
mycomponent3 - Display Credit Data
mycomponent4 - Display Shipping Data
Is it possible for mycomponent1 to fire a single event, with each of
components 2 - 4 having an event listener on that same event?
I noticed that DK mentioned: "use standard flex Event and place
dispatch and listen at systemManager level."
What is meant at the systemManager level?
Thanks Andrew
--- In [email protected], "rough68fish" <[EMAIL PROTECTED]> wrote:
>
> All of my views are bound to models. I have data specific models and
> models that drive views (kind of like the ViewHelper class). so the
> event would result in a change to the view model which would update
> the view.
>
> The way I have it setup is there is an AppModelLocator application
> wide data models (like my user object are bound here) I then have
> models for application states (like login and home). These models have
> some specific variables to drive the views. Strict Cairngorm would
> have you put these variable in a ViewHelper.
>
> I also (although not strick MVC) use mx:Binding statements to link the
> source view to the model when the event would do nothing more than
> update the variable (for example when the user selects an item in a
> grid I bind grid selected item to model selected item.)
>
> --Sean
>
>
> --- In [email protected], "Douglas Knudsen"
> <douglasknudsen@> wrote:
> >
> > I too use Cairngorm and would suggest it. Issue I have though is if
> your
> > view, in Andrew's case his component, just needs to react to what
> another
> > component did at the gesture/view level only. Since a Command is not
> > supposed to talk to the view directly, and in this case needs too, I
> feel
> > cornered in this case. What I have been starting to do is use
> standard flex
> > Event and place dispatch and listen at systemManager level.
> >
> > DK
> >
> > On 3/12/07, rough68fish <rough68fish@> wrote:
> > >
> > > There are a lot of ways to do what you are asking personally I
like to
> > > use Cairngorm since it provides a good model for handling this
type of
> > > thing and provides a nice separation between my components.
> > >
> > > Otherwise one way would be to have your main application invoke
> > > methods within your components when it catches the events.
> > >
> > > in mainAppHandler...
> > > mycomponent2.handler();
> > >
> > > --- In [email protected], "greenfishinwater"
> > > <greenfishinwater@> wrote:
> > > >
> > > > I have an application:
> > > >
> > > > TabNavigator
> > > > mycomponent1 - Edit parameters
> > > > mycomponent2 - Display A
> > > > mycomponent3 - Display B
> > > > mycomponent4 - Display C
> > > >
> > > > When I have changed some parameters in mycomponent1 I want to
> fire an
> > > > event in mycomponent1, and then in mycomponent2 to mycomponent4
> listen
> > > > for that event and then do local processing within that specific
> > > > component.
> > > >
> > > > I can fire the event in mycomponent1, and I can successfully
listen
> > > > for it in the main app. But I am having problems setting up event
> > > > listeners in mycomponent2 to mycomponent4.
> > > >
> > > > Can anybody help?
> > > >
> > > > Andrew
> > > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Douglas Knudsen
> > http://www.cubicleman.com
> > this is my signature, like it?
> >
>