Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: StateMachine with <mx:State> vs StateMachine with <mx:ViewStack>  (Read 4608 times)
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
« Last Edit: July 21, 2009, 07:29:18 by puremvc » Logged
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« Reply #2 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)
Logged
Pages: [1]
Print