if i call init() too i can reset the data model but i cant reset the
state of all the UI components. So i need to destroy the objects in
the application state and they should get freshly created. and call
the init() method in the creation complete method of the application
state so that it fetches the data. which makes the UI and the data
model that binds to UI perfecly alligned.

--- In [email protected], "Clinton D. Judy" <[EMAIL PROTECTED]> wrote:
>
> <mx:Button click="init()" />
> 
>  
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Clinton D. Judy
> Sent: Thursday, January 31, 2008 12:01 PM
> To: [email protected]
> Subject: RE: [flexcoders] How can we destroy the chaild in the other
> state before moving to the new state.
> 
>  
> 
> What's the button do that logs the user in? Just have that button call
> init() instead.
> 
>  
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of srikanth_reddy_007
> Sent: Thursday, January 31, 2008 11:59 AM
> To: [email protected]
> Subject: [flexcoders] How can we destroy the chaild in the other state
> before moving to the new state.
> 
>  
> 
> Hi,
> 
> I have an application which has two states - one Login state and
> Application state. Once the login is authenticated i move it to
> application state and it initializes itself with the init method()
> call. After working on the application state when once the session
> expires i reset the application from application state to to login
> state. and after that if the user logs in i set the application again
> from login state to application state. then it is not calling the
> init() method of the application state. Means it just displays the
> previously created state with the previous data. what i want is when
> ever i move to login state i should destroy the children in the
> application state and when ever i login again the application state
> should get created again freshly.
> 
> The code snippet i tried is :
> 
> <mx:Application creationComplete=init()">
> 
> private function init():void {
> // Code to display login state. or silent login to application state
> if authenticated from Active directory.
> }
> 
> <mx:states>
> <mx:State name="LoginState">
> <mx:AddChild position="lastChild">
> <component:LoginView id="loginView" x="0" y="0" width="100%"
> height="100%">
> </component:LoginView>
> </mx:AddChild>
> </mx:State>
> <mx:State name="ApplicationState">
> <mx:AddChild position="lastChild">
> <component:CoreApplication id="applicationView" x="0" y="0"
> width="100%" height="100%">
> </component:CoreApplication >
> </mx:AddChild>
> </mx:State>
> </mx:states>
> 
> i tried setting applicationView to null in the EnterState, Activate
> events of the LoginState but failed to destroy the application View. I
> even tried <mx:RemoveChild in the login state but it is not destroying
> the application view object and creating it again. it just removes it
> from view and adds it back the same object.
> 
> Can some body pleas help!!!
>


Reply via email to