Save state of the toolbox in SharedObject
authorAndy Allan <gravitystorm@gmail.com>
Thu, 19 Aug 2010 13:57:42 +0000 (13:57 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Thu, 19 Aug 2010 13:57:42 +0000 (13:57 +0000)
net/systemeD/potlatch2/Toolbox.mxml

index c086e5b..8770da4 100644 (file)
 
                public function init(controller:EditController):void {
                        this.controller=controller;
+            /* check if the toolbox was explictly turned off in a previous session */
+            if( SharedObject.getLocal("user_state").data['toolbox_visible'] == false) {
+              this.visible = false;
+            }
                }
 
                override protected function createChildren():void {
@@ -91,6 +95,9 @@
                
                public function toggle():void {
                        this.visible=!this.visible;
+            var obj:SharedObject = SharedObject.getLocal("user_state");
+            obj.setProperty("toolbox_visible",this.visible);
+            obj.flush();
                }
                
                // --------------------------------------------------------------------------------