Title: StateMachine with <mx:State> vs StateMachine with <mx:ViewStack> Post by: polykrom on July 19, 2009, 11:42:32 Hi,
I was wondering what is the best way to implement state change mechanism. In differents examples i saw when google it, the ViewStack solution is often used but what about State solution ? In my application i've implemented the State solution with a currentState="{state}" in the component definition, and everything is allright. The only difference using that way is that i've to create a switch to notify the Application facade in the component Mediator with the correct component reference in place of the currentState. Is it a "best practice" or a wrong way ? thanks a lot pureMVC rocks ! Poly Title: Re: StateMachine with <mx:State> vs StateMachine with <mx:ViewStack> Post by: puremvc on July 20, 2009, 01:57:06 The ViewStack vs State issue really has no bearing on the use of the StateMachine utility, which governs application wide state.
The ViewStack and Flex State are ways inside of a view component to represent visual state of the component. Via a view component's Mediator, changes in the application state by the StateMachine can, with equal ease, be used to trigger the change of a component to a new Flex State or to show a new child of a ViewStack. Seek wisdom in the wider Flex community regarding ViewStack vs Flex States. From my own experience, the nice thing about a Flex State is that if only a few things change between states, then you don't end up recreating the similar parts in multiple view components, shown as children of a ViewStack. And they support complex visual transitions of the components elements to new arrangements going from State to State. However if there is a lot of difference in the various states (i.e. the separate forms of a checkout process), then I find the State MXML to be too cumbersome, and want the forms to be separate view components in a ViewStack. -=Cliff> Title: Re: StateMachine with <mx:State> vs StateMachine with <mx:ViewStack> Post by: polykrom on July 20, 2009, 04:04:51 Thanks a lot Cliff... I think i'm in the right way regarding your answer ! regards !! François (Belgian pureMVC addict) |