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 26567ceea6b9cc89384feeb538e2092be70f3335..2259c6b20d23bb2e8a1025a0dc2ceac391308e5a 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 3020866a7dd75f4ecdc45ee10b2e1013b70dd967..03165b81fbec2c25745a96443d94f2ab01d7615d 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 a58c97b0d99dbfd5969416567af579831f8c6f8c..1826e26163149ffd7b50577d69ad99eba0736203 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 ae40fcde39dffcbdf4b61faaf3019cf947ccd67a..81b4a4a13fa306844ee4cb8717a738cea8bdef74 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 4cd0989957f755bacf2abb01b1a251bb21d34977..4ae8973a91a438aab5390180b5035255cf54ce05 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 ac1b1995cb7566c67f7b05df21f52a1aca411c46..c75fe08535a041382870ea913a5ef27378d20e4a 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 887aa9947936b16a51252d79816dcfe8f7a8397a..f42776cd7fb0857088d8c7e5da6a22cb486eb5b9 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 c126d11da071c7d7629f2014622c2e70a52f690c..8a95d102b48b4c2055aa86846416df3996b5284c 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 fd3214c756de96704ef8e9d2f5be229bffdd0a65..931c4074d14abbfe18b2f30feea94a6dbab0e4fe 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 3955aa2c7006debd15ee428936867e1fca675b51..f53583c96172cdadd51bfee4cc7cfbd8a6d00219 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 547ef510ce5f86cde779f3199da204e9873b9fd3..76245e4ac2326cdc9e48cfe204b0fc494c8b01f3 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