Yes, I think all history manager information is stored as strings so type is not going to be maintained and you’ll need to deal with that in your loadState method.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of rockmoyosa
Sent: Thursday, July 07, 2005 7:18 AM
To: [email protected]
Subject: [flexcoders] Re: HistoryManger state is undefined on loading

 

I tell what happened. state. objects are now STRINGS(!?)

<< DUMP START >>
this:Object
|        model = [object Object]  (string)
|        view = false  (string)

I can overcome the view by:
var detailVisible = Boolean(state.view == "true");

But for model it's a different story.



--- In [email protected], "rockmoyosa" <[EMAIL PROTECTED]> wrote:
> My case:
>
> - saveState is executed
> - On "Back" loadState is executed.
>
> But.....
> Than my state is "undefined"
>
>
> private var changed:Boolean;
>      
>       public function initHistory():Void {
>             mx.managers.HistoryManager.register(this);
>             storeInternalState();
>       }
>      
>       public function saveState():Object {
>             // called by HistoryManager, tells the component
>             // to create a "state" object and to return it\
>             var state = new Object();
>             state.model = Model.getInstance();
>             state.view = this._scope.m_detailview;
>            
>             mx.controls.Alert.show(""+this._scope.m_detailview.visible);
>             Log.debug("hello"+state);
>             return state;
>       }
>      
>       public function loadState(state:Object):Void {
>             // called by HistoryManager, passes in a state
>             // object so the component can rebuild it's state
>             mx.controls.Alert.show("state: "+state.view);
>             restoreInternalState(state);
>       }
>      
>       public function savePresent():Void {
>             storeInternalState( );
>       }
>
>       public function storeInternalState():Void {
>             mx.managers.HistoryManager.save();
>       }
>      
>       public function restoreInternalState(state:Object):Void {
>             Log.dump(state);
>             Log.debug("@@@@state.view.visible@@@@: "+state.view.visible);
>            
>             if(state.view.visible == true && this._scope.m_detailview.visible ==
> false ||
>                                  state.view.visible == false &&
> this._scope.m_detailview.visible == true){
>                   toggleView();
>             }
>             Model.getInstance().restoreInstance(state.model);
>       }




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to