I am facing the same question. "What is the best way to manage application view states with Cairngorm2?"
The pattern where you use > > Model: > > public static var workflowState:Number = 0; > > public static var VIEWING_SOMETHING:Number = 0; > > public static var VIEWING_SOMETHING_ELSE:Number = 1; > > public static var VIEWING_ANOTHER_THING:Number = 2; Seem ok for a small application, but would become a pain if you have dozens of Views. Binding the selectedIndex of the ViewStack is also anouther way I have tried to manage view states, but there are draw backs there as well. Setting the currentState directly from the componets in the view is also problematic. Anyone have a good way to handle this? --jason --- In [email protected], "christophers1228" <[EMAIL PROTECTED]> wrote: > > That makes sense, I guess I'm a little confused because the coldfusion > application wizard generates a "login" state and "mainApplication" > state and that's where I saw the first real implementation of states. > > I do realize that it could be done any number of ways, I was just > looking for some input as to why you would do it one way or another. > > > --- In [email protected], "Renaun Erickson" renaun@ wrote: > > > > The main thing here is if you use Views with ViewHelpers you should > > have those as separate views and not use <mx:States>. States in my > > preception are more for UI changes within a view then what the > > switching containers or larger sets of UI. > > > > Now this is not to say you can use the States for changing containers > > like that of the ViewStack, it just seems its not the purpose of it. > > > > From the livedocs: > > > > "The State class defines a view state, a particular view of a > > component. For example, a product thumbnail could have two view > > states; a base view state with minimal information, and a rich view > > state with additional information." > > > > More reading: > > > http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/ww\ help.htm?context=LiveDocs_Parts&file=00000923.html#321190 > > > > Renaun > > > > --- In [email protected], "christophers1228" > > <chris.sharon@> wrote: > > > > > > Thanks for the input. Maybe I've been misunderstanding the way to use > > > them from the beginning. ( very possible ) > > > > > > Let me give a better example, to make sure i'm not way out in left > > field. > > > > > > This is a typical way I manage the state. > > > > > > <viewstack selectedIndex={ModelLocator.workflowState}> > > > <view:Something> > > > <view:SomethingElse> > > > <view:AnotherThing> > > > </viewstack> > > > > > > Model: > > > public static var workflowState:Number = 0; > > > public static var VIEWING_SOMETHING:Number = 0; > > > public static var VIEWING_SOMETHING_ELSE:Number = 1; > > > public static var VIEWING_ANOTHER_THING:Number = 2; > > > > > > Inside of a view: > > > <mx:Button click="ModelLocator.workflowState = > > > ModelLocator.VIEWING_SOMETHING" /> > > > > > > it seems like this should accomplish the same thing: > > > <mx:States> > > > <mx:State name="Something"> > > > <mx:AddChild position="lastChild"> > > > <view:Something id="somethingView" /> > > > </mx:AddChild> > > > </mx:State> > > > <mx:State name="SomethingElse"> > > > <mx:AddChild position="lastChild"> > > > <view:SomethingElse id="somethingElseView" /> > > > </mx:AddChild> > > > </mx:State> > > > <mx:State name="AnotherThing"> > > > <mx:AddChild position="lastChild"> > > > <view:AnotherThing id="anotherThingView" /> > > > </mx:AddChild> > > > </mx:State> > > > </mx:States> > > > > > > Inside of a view: > > > <mx:Button click="this.setCurrentState('SomethingElse')"/> > > > > > > I have noticed in messing around with it, that maybe you could bind > > > the current state to the model and change from a number to a string. > > > > > > sorry for the long post, just trying to learn something :) > > > > > > Thanks, > > > Chris > > > > > > > > > --- In [email protected], "Renaun Erickson" <renaun@> wrote: > > > > > > > > The states as used in Cairngorm will not correlate with the > > > > <mx:states> in Flex 2. The serve different purposes. Well let me > > > > step back and say, this is how I feel about it. > > > > > > > > Flex 2 states are good for view/control states where Cairngorm > > > > workflow states are just that work/process flow. > > > > > > > > Thats not to say you can't have an attribute on the Cairngorm > model to > > > > facilitate something you are trying to do with <mx:states> > > > > > > > > Renaun > > > > > > > > --- In [email protected], "christophers1228" > > > > <chris.sharon@> wrote: > > > > > > > > > > Hello, > > > > > I've been using cairngorm for about a year now (flex 1.5) and > I just > > > > > started some projects using flex 2. (I have to admit I've been > using > > > > > and still trying to understand at the same time :) ) > > > > > I was just wondering, how do the new view states in flex2 fit in > > with > > > > > managing the state in the model. > > > > > > > > > > i.e. ModelLocator.workflowState = ModelLocator.VIEWING_SOMETHING; > > > > > vs. > > > > > <mx:State name="ViewingSomething"> > > > > > > > > > > > > > > > I just got to the point were I was pretty comfortable with the > > flow of > > > > > cairngorm (it's taught me alot about architecture) I'm just > > wondering > > > > > how to fit some of the new features of flex2 in. > > > > > > > > > > Any ideas? > > > > > > > > > > > > > > > -- 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

