Hi  All,
                    I am trying to save view stack's current view using
shared object so that it remains selected on page refresh. I am also
planning to push some global data( very small and primitive) accessed and
modified  by  all  components.  But  that doesn't seem to work. Whats  wrong
?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
xmlns:ns1="*"
     creationComplete="isReloaded();">
    <mx:ViewStack x="10" y="10" id="viewstack1" width="100%" height="100%"
childIndexChange="saveIndex();">

        <ns1:FirstView id="two"/>

        <ns1:SecondView id="one"/>

    </mx:ViewStack>

    <mx:Script>
        <![CDATA[

             public var mySO:SharedObject = SharedObject.getLocal
("userDetails");

             private function isReloaded():void
             {
                 if( mySO.data.viewIndex != null )
                     viewstack1.selectedIndex = mySO.data.viewIndex;
             }

             private function saveIndex():void
             {
                 mySO.data.viewIndex = viewstack1.selectedIndex;
                 mySO.flush();
             }
        ]]>
    </mx:Script>
</mx:Application>



-- 


Regards,
Yogesh

Reply via email to