Thanks for the input Brennan, This makes sense because once you get into the child components, this.currentState I believe refers to the component itself and not the application. So would you have the view update the model directly or would you have a command that updates the model?
Thanks for the input, Chris --- In [email protected], "dreuimar" <[EMAIL PROTECTED]> wrote: > > Chris, > > What I usually do is have something like: > > <mx:Application currentState="{model.selectedState}" ... > > > ... > > <mx:States> > <mx:State name="{model.SOMESTATE}"> > <mx:AddChild position="lastChild"> > <view:Something id="somethingView" /> > </mx:AddChild> > </mx:State> > <mx:State name="{model.SOMETHINGELSE}"> > <mx:AddChild position="lastChild"> > <view:SomethingElse id="somethingElseView" /> > </mx:AddChild> > </mx:State> > <mx:State name="{model.SOMETHINGELSEAGAIN}"> > <mx:AddChild position="lastChild"> > <view:AnotherThing id="anotherThingView" /> > </mx:AddChild> > </mx:State> > </mx:States> > > And at the creation complete of the application I"ll simply put: > model.selectedState = model.SOMESTATE; > > Then whenever you want to switch just set model.selectedState to > something else.' > > Brennan > > --- 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/

