Retain preferences even when .swf filename has changed
authorRichard Fairhurst <richard@systemeD.net>
Mon, 14 May 2012 10:20:37 +0000 (11:20 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Mon, 14 May 2012 10:20:37 +0000 (11:20 +0100)
net/systemeD/potlatch2/BackgroundSelector.mxml
net/systemeD/potlatch2/FunctionKeyManager.as
net/systemeD/potlatch2/Toolbox.mxml
net/systemeD/potlatch2/collections/Imagery.as
net/systemeD/potlatch2/collections/Stylesheets.as
net/systemeD/potlatch2/dialogs/OptionsDialog.mxml
net/systemeD/potlatch2/find/FindDialog.mxml
net/systemeD/potlatch2/help/HelpDialog.mxml
net/systemeD/potlatch2/save/SaveManager.as
net/systemeD/potlatch2/tools/Simplify.as
potlatch2.mxml

index 26567ce..2259c6b 100644 (file)
 
                public function setDimming(v:Boolean):void {
                        FlexGlobals.topLevelApplication.theMap.setDimming(dim.selected);
-                       var obj:SharedObject=SharedObject.getLocal("user_state");
+                       var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_dim',v);
                        obj.flush();
                }
                public function setSharpen(v:Boolean):void {
                        FlexGlobals.topLevelApplication.theMap.setSharpen(sharpen.selected);
-                       var obj:SharedObject=SharedObject.getLocal("user_state");
+                       var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_sharpen',v);
                        obj.flush();
                }
index 3020866..03165b8 100644 (file)
@@ -26,8 +26,8 @@ package net.systemeD.potlatch2 {
 
                public function FunctionKeyManager() {
                        for (var i:uint=1; i<16; i++) {
-                               if (SharedObject.getLocal("user_state").data['F'+i]) {
-                                       keys[i]=SharedObject.getLocal("user_state").data['F'+i];
+                               if (SharedObject.getLocal("user_state","/").data['F'+i]) {
+                                       keys[i]=SharedObject.getLocal("user_state","/").data['F'+i];
                                }
                        }
                }
@@ -42,7 +42,7 @@ package net.systemeD.potlatch2 {
 
                public function setKey(fkey:uint, code:String, value:String):void {
                        keys[fkey]={ code:code, value:value };
-                       var obj:SharedObject=SharedObject.getLocal("user_state");
+                       var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('F'+fkey,{ code:code, value:value });
                        obj.flush();
                        dispatchEvent(new Event("key_changed"));
@@ -52,7 +52,7 @@ package net.systemeD.potlatch2 {
                        if (key=='') {
                                var oldKey:String=getKeyFor(code,value);
                                keys[Number(oldKey.substr(1))]=null;
-                               var obj:SharedObject=SharedObject.getLocal("user_state");
+                               var obj:SharedObject=SharedObject.getLocal("user_state","/");
                                obj.setProperty(oldKey,null);
                                obj.flush();
                        } else {
index a58c97b..1826e26 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) {
+                       if( SharedObject.getLocal("user_state","/").data['toolbox_visible'] == false) {
                          this.visible = false;
                        }
                }
                
                public function toggle():void {
                        this.visible=!this.visible;
-                       var obj:SharedObject = SharedObject.getLocal("user_state");
+                       var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty("toolbox_visible",this.visible);
                        obj.flush();
                }
index ae40fcd..81b4a4a 100644 (file)
@@ -45,9 +45,9 @@ package net.systemeD.potlatch2.collections {
                        var xml:XML = new XML(fileBank.getAsString(filename));
                        var saved:Object = {};
                        var bg:Object;
-                       if (SharedObject.getLocal("user_state").data['background_url']!=undefined) {
-                               saved={ name: SharedObject.getLocal("user_state").data['background_name'],
-                                               url:  SharedObject.getLocal("user_state").data['background_url' ] };
+                       if (SharedObject.getLocal("user_state","/").data['background_url']!=undefined) {
+                               saved={ name: SharedObject.getLocal("user_state","/").data['background_name'],
+                                               url:  SharedObject.getLocal("user_state","/").data['background_url' ] };
                        }
 
                        var isSet:Boolean=false;
@@ -148,7 +148,7 @@ package net.systemeD.potlatch2.collections {
                        _overlay.visible=bg.attribution || bg.logo || bg.terms_url;
                        setLogo(); setAttribution(); setTerms();
                        // save as SharedObject for next time
-                       var obj:SharedObject = SharedObject.getLocal("user_state");
+                       var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_url' ,String(bg.url));
                        obj.setProperty('background_name',String(bg.name));
                        obj.flush();
index 4cd0989..4ae8973 100644 (file)
@@ -27,7 +27,7 @@ package net.systemeD.potlatch2.collections {
                public function init(request_url:String=null):void {
                        // First, we set _selected in case it's needed before the stylesheet catalogue loads
                        var url:String = request_url;
-                       url = url ? url : SharedObject.getLocal("user_state").data['stylesheet_url'];
+                       url = url ? url : SharedObject.getLocal("user_state","/").data['stylesheet_url'];
                        url = url ? url : DEFAULT;
 
                        _selected = new Stylesheet("Default", url);
@@ -40,8 +40,8 @@ package net.systemeD.potlatch2.collections {
 
                private function onStylesheetsLoad(fileBank:FileBank, filename:String, request_url:String=null):void {
                        var xml:XML = new XML(fileBank.getAsString(filename));
-                       var saved_url:String = SharedObject.getLocal("user_state").data['stylesheet_url'];
-                       var saved_name:String= SharedObject.getLocal("user_state").data['stylesheet_name'];
+                       var saved_url:String = SharedObject.getLocal("user_state","/").data['stylesheet_url'];
+                       var saved_name:String= SharedObject.getLocal("user_state","/").data['stylesheet_name'];
                        if (request_url && request_url!=saved_url) { saved_url=request_url; saved_name='Custom'; }
                        var isInMenu:Boolean=false, isSet:Boolean=false;
 
@@ -87,7 +87,7 @@ package net.systemeD.potlatch2.collections {
                public function setStylesheet(ss:Stylesheet):void {
                        _selected=ss;
                        dispatchEvent(new CollectionEvent(CollectionEvent.SELECT, ss.url));
-                       var obj:SharedObject = SharedObject.getLocal("user_state");
+                       var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty("stylesheet_url",ss.url);
                        obj.setProperty("stylesheet_name",ss.name);
                        obj.flush();
index ac1b199..c75fe08 100644 (file)
@@ -57,7 +57,7 @@
     import net.systemeD.halcyon.connection.Connection;
     import net.systemeD.halcyon.connection.StatusFetcher;
 
-       private var userState:SharedObject=SharedObject.getLocal("user_state");
+       private var userState:SharedObject=SharedObject.getLocal("user_state","/");
     
     public function init():void {
         PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
index 887aa99..f42776c 100644 (file)
@@ -33,7 +33,7 @@
                        PopUpManager.centerPopUp(this);
                        this.addEventListener(CloseEvent.CLOSE, findDialog_close);
                        
-                       var obj:SharedObject = SharedObject.getLocal("user_state");
+                       var obj:SharedObject = SharedObject.getLocal("user_state","/");
        
                }
                
index c126d11..8a95d10 100644 (file)
@@ -24,7 +24,7 @@
         this.addEventListener(CloseEvent.CLOSE, helpDialog_close);
 
         // store whether the user has seen the help dialog before
-        var obj:SharedObject = SharedObject.getLocal("user_state");
+        var obj:SharedObject = SharedObject.getLocal("user_state","/");
         obj.setProperty("help_shown","true");
 
         buildShortCuts();
index fd3214c..931c407 100644 (file)
@@ -41,7 +41,7 @@ package net.systemeD.potlatch2.save {
             var listener:Function = function(event:Event):void {
                 var accessToken:OAuthToken = oauthPanel.accessToken;
                 if ( oauthPanel.shouldRemember ) {
-                    var obj:SharedObject = SharedObject.getLocal("access_token");
+                    var obj:SharedObject = SharedObject.getLocal("access_token","/");
                     obj.setProperty("oauth_token", accessToken.key);
                     obj.setProperty("oauth_token_secret", accessToken.secret);
                     obj.flush();
index 3955aa2..f53583c 100644 (file)
@@ -22,8 +22,8 @@ package net.systemeD.potlatch2.tools {
                public static function simplify(way:Way, map:Map, keepOffscreen:Boolean, tolerance:Number=NaN):void {
                        if (way.length<3) { return; }
                        if (isNaN(tolerance)) {
-                               if (SharedObject.getLocal("user_state").data['simplify_tolerance']!=undefined) {
-                                       tolerance=Number(SharedObject.getLocal("user_state").data['simplify_tolerance']);
+                               if (SharedObject.getLocal("user_state","/").data['simplify_tolerance']!=undefined) {
+                                       tolerance=Number(SharedObject.getLocal("user_state","/").data['simplify_tolerance']);
                                } else {
                                        tolerance=0.00005;
                                }
index 547ef51..76245e4 100644 (file)
                        saveLabel=saveButton.label;
 
                        // populate sharedObject with loaderInfo parameters if supplied
-                       var obj:SharedObject = SharedObject.getLocal("user_state");
+                       var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        var objChanged:Boolean = false;
                        if (loaderInfo.parameters['tileurl']) {
                                obj.setProperty('background_url',loaderInfo.parameters['tileurl']); 
                        // pass additional parameters to map
                        var params:Object={}; var k:String;
                        for (k in this.loaderInfo.parameters) params[k]=this.loaderInfo.parameters[k];
-                       for (k in SharedObject.getLocal('user_state').data) params[k]=SharedObject.getLocal('user_state').data[k];
+                       for (k in SharedObject.getLocal('user_state',"/").data) params[k]=SharedObject.getLocal('user_state',"/").data[k];
 
                        // Create map
                        theMap=new Map();
                        theController.addEventListener(AttentionEvent.ALERT, onAlert);
             
             // set the access token from saved cookie
-            var tokenObject:SharedObject = SharedObject.getLocal("access_token");
+            var tokenObject:SharedObject = SharedObject.getLocal("access_token","/");
             conn.setAccessToken(tokenObject.data["oauth_token"], tokenObject.data["oauth_token_secret"]);
 
             // Load any requested GPX track