PDA

View Full Version : When to use View State?


nmduc073
11-29-2007, 04:46 AM
Hi,
I am confused of View State. From https://service.acrobat.com/livedocs/flex/2/langref/mx/states/State.html, view state is a particular view of a component. It also gives an example which there is login form. When it has one more text box, it is a new view state. However, I still don't understand. Why do we have to use a view state in that example? Why don't we just write ActionScript code to add a textbox in the click event? What kind of changes can make a new view state? Is it a new view state if I change the color of text box?

Please tell me when we should use View State? Is there any drawback with view state?
Thank in advance.

dr_zeus
11-30-2007, 06:40 PM
Generally, you would create a state when you want to add or remove sub controls from a component under specific conditions. Another example is adding advanced options to a search form.

States become especially useful when you combine them with transitions for animation.

nmduc073
12-01-2007, 03:31 AM
Thank you.