I am new to Flex , i am trying to understand View States , tried for one hour but got confused .
(Basically by seeing the examples i understood the concept , but failed to implement )
Please help .
Assume my requirement is at the load of the page , i want to show an Login Button and a Chnage State Button (common button) only .and when the Change State button is clicked on ,i want to show the Register Button .
So for this i made two Forms , and a common button .
( I think some how i can write the Logic to chnage to the current state to loginForm when user clicks with some inline code , but please tell me At the start of the page please tell me why I am not able to show the Register.
Something to understand, you have three states defined: A state called "Register", a state called "loginForm" and an unnamed state. Register sets a property on the Application called RegForm giving it the value "Register". loginForm sets a property on the Application called RegForm giving it the value "Login". The unnamed state shows two forms, each containing a button. Since these properties are custom to your application your state change (if it were triggered) would propably generate an error or do nothing.
You have nothing to trigger a state change. I would recommend you stop looking at states for a while and go learn about events, which are a much more central topic in Flex than states. You will not be able to do much with Flex unless you take the time to unsderstand this very important concept.
What I think you want from your states is one form with a button whose label and operation changes. Is that right? In which case, I think your Application only needs one Form, and you only need one state that sets the label property on your form's button to the appropriate value. Whatever function response to this button's click event can direct its operation.
NB: The easiest way to create view states in unsing the GUI builder in FlexBuilder.