Hi Seb,

Thanks for the reply, I like you idea, it makes sense. If I create an
event which is fired during start up a I can in theory reuse the same
event in the menu I'm creating. All it will be doing is passing the
name of the state to change to.

One thing I will do is when the event is fired during start up I won't
pass a value for the state name, then in my Command I can check for
this value and as it doesn't exist I can call the default state
(Login). Do you think this is a good idea?

Stephen





--- In [email protected], "Sebastian Zarzycki" <[EMAIL PROTECTED]>
wrote:
>
> I'm fighting with this as well. The idea you've presented fits well
> Cairngorm, the problem is ... this is not really a best a idea. You
need to
> create an Event, then put the desired state string into the event
(where to
> get this string from?), dispatch event, register in front
controller, create
> a command and in command get the data from event and change the
model value
> accordingly. This does not seem like bad, if you just manage single
state.
> Now imagine that you use components and they have their own states.
What's
> more, you would probably want to react on higher level on a state
> broadcaster down below. You need to create as many events/commands
as the
> amount of your components, and what's more : you're inevitably
coupling them
> with cairngorm.
> 
> My blueprint would be to have each component managing its own state
in his
> as code. State is bound to component the same way you've described (by
> currentState). Each component has method changeState and probably
exports
> static strings with state names. When the state is changed from
within the
> component, the basic flash event is broadcasted, and you react to it
on the
> level (container) that holds this component as child.
> 
> Probably a bit way off your question, anyway :P Generally, for your
needs,
> the solution you presented feels valid to me.
> 
> Seb
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of stephen50232
> Sent: Wednesday, November 21, 2007 6:01 PM
> To: [email protected]
> Subject: [flexcoders] Managing States and Cairngorm
> 
> Hi,
> 
> I'm building a new app using Cairgorm and one of the problems I'm
> having is managing states. 
> My application is set up with a base state which is blank and then two
> other states, one which contains my login screen (called Login) and
> one which contains the main menu (called MainApp). Then all my other
> states are based on the state called MainApp so that they all contain
> the main menu. 
> 
> Now when my application starts it should go to the Login state, then
> after logging in the system will load the Welcome state, which is
> based on the MainApp state. So to change between states in my
> Application tag I have set currentState like this:
> 
> currentState="{model.workflowState}"
> 
> When my application first starts it should load the Login state as
> default, I set the model.workflowState variable as:
> 
> public var workflowState:String = "Login";
> 
> Will I be able to update the model.workflowState? The way I am
> thinking of doing this is by having an event on all the menu buttons
> which changes model.workflowState to the value of the state, for
> example if the user clicks on the Welcome button, model.workflowState
> is set as "Welcome".
> 
> Now is this a good way to manage states in a Cairngorm application,
> I'm trying to achieve 2 things, one only have one main menu which is
> used in all states, and two use binding to select the current state.
> 
> Is there another way I could do this?
> 
> Thanks
> 
> Stephen
> 
> 
> 
> --
> 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
>


Reply via email to