Don't throw an exception if user has disabled SharedObjects
authorRichard Fairhurst <richard@systemeD.net>
Sat, 1 Sep 2012 16:28:30 +0000 (17:28 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Sat, 1 Sep 2012 16:28:30 +0000 (17:28 +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/save/SaveManager.as
potlatch2.mxml

index 2259c6b..6ca5c85 100644 (file)
                        FlexGlobals.topLevelApplication.theMap.setDimming(dim.selected);
                        var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_dim',v);
                        FlexGlobals.topLevelApplication.theMap.setDimming(dim.selected);
                        var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_dim',v);
-                       obj.flush();
+                       try { obj.flush(); } catch (e:Error) {}
                }
                public function setSharpen(v:Boolean):void {
                        FlexGlobals.topLevelApplication.theMap.setSharpen(sharpen.selected);
                        var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_sharpen',v);
                }
                public function setSharpen(v:Boolean):void {
                        FlexGlobals.topLevelApplication.theMap.setSharpen(sharpen.selected);
                        var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_sharpen',v);
-                       obj.flush();
+                       try { obj.flush(); } catch (e:Error) {}
                }
     ]]></fx:Script>
 </s:BorderContainer>
                }
     ]]></fx:Script>
 </s:BorderContainer>
index 03165b8..494ce61 100644 (file)
@@ -44,7 +44,7 @@ package net.systemeD.potlatch2 {
                        keys[fkey]={ code:code, value:value };
                        var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('F'+fkey,{ code:code, value:value });
                        keys[fkey]={ code:code, value:value };
                        var obj:SharedObject=SharedObject.getLocal("user_state","/");
                        obj.setProperty('F'+fkey,{ code:code, value:value });
-                       obj.flush();
+                       try { obj.flush(); } catch (e:Error) {}
                        dispatchEvent(new Event("key_changed"));
                }
 
                        dispatchEvent(new Event("key_changed"));
                }
 
@@ -54,7 +54,7 @@ package net.systemeD.potlatch2 {
                                keys[Number(oldKey.substr(1))]=null;
                                var obj:SharedObject=SharedObject.getLocal("user_state","/");
                                obj.setProperty(oldKey,null);
                                keys[Number(oldKey.substr(1))]=null;
                                var obj:SharedObject=SharedObject.getLocal("user_state","/");
                                obj.setProperty(oldKey,null);
-                               obj.flush();
+                               try { obj.flush(); } catch (e:Error) {}
                        } else {
                                setKey(Number(key.substr(1)),code,value);
                        }
                        } else {
                                setKey(Number(key.substr(1)),code,value);
                        }
index 1826e26..a5a59f3 100644 (file)
                        this.visible=!this.visible;
                        var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty("toolbox_visible",this.visible);
                        this.visible=!this.visible;
                        var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty("toolbox_visible",this.visible);
-                       obj.flush();
+                       try { obj.flush(); } catch (e:Error) {}
                }
                
                // --------------------------------------------------------------------------------
                }
                
                // --------------------------------------------------------------------------------
index 81b4a4a..376f56a 100644 (file)
@@ -151,7 +151,7 @@ package net.systemeD.potlatch2.collections {
                        var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_url' ,String(bg.url));
                        obj.setProperty('background_name',String(bg.name));
                        var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty('background_url' ,String(bg.url));
                        obj.setProperty('background_name',String(bg.name));
-                       obj.flush();
+                       try { obj.flush(); } catch (e:Error) {}
                }
                
                public function get selected():Object { return _selected; }
                }
                
                public function get selected():Object { return _selected; }
index 4ae8973..94fe417 100644 (file)
@@ -90,7 +90,7 @@ package net.systemeD.potlatch2.collections {
                        var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty("stylesheet_url",ss.url);
                        obj.setProperty("stylesheet_name",ss.name);
                        var obj:SharedObject = SharedObject.getLocal("user_state","/");
                        obj.setProperty("stylesheet_url",ss.url);
                        obj.setProperty("stylesheet_name",ss.name);
-                       obj.flush();
+                       try { obj.flush(); } catch (e:Error) {}
                }
 
                /** The currently selected stylesheet */
                }
 
                /** The currently selected stylesheet */
index c75fe08..1870701 100644 (file)
         FlexGlobals.topLevelApplication.theMap.redraw();
 
         userState.setProperty("tiger_highlighted",tigercheck.selected);
         FlexGlobals.topLevelApplication.theMap.redraw();
 
         userState.setProperty("tiger_highlighted",tigercheck.selected);
-        userState.flush();
+        try { userState.flush(); } catch (e:Error) {}
     }
 
        private function simplifySet():void {
         userState.setProperty("simplify_tolerance",simplifyslider.value*0.00001);
     }
 
        private function simplifySet():void {
         userState.setProperty("simplify_tolerance",simplifyslider.value*0.00001);
-        userState.flush();
+        try { userState.flush(); } catch (e:Error) {}
        }
 
        private function licenceToggle():void {
        }
 
        private function licenceToggle():void {
index 931c407..60ff4ab 100644 (file)
@@ -44,7 +44,7 @@ package net.systemeD.potlatch2.save {
                     var obj:SharedObject = SharedObject.getLocal("access_token","/");
                     obj.setProperty("oauth_token", accessToken.key);
                     obj.setProperty("oauth_token_secret", accessToken.secret);
                     var obj:SharedObject = SharedObject.getLocal("access_token","/");
                     obj.setProperty("oauth_token", accessToken.key);
                     obj.setProperty("oauth_token_secret", accessToken.secret);
-                    obj.flush();
+                    try { obj.flush(); } catch (e:Error) {}
                 }
                 onCompletion();
             }
                 }
                 onCompletion();
             }
index 76245e4..1fcdf25 100644 (file)
                                obj.setProperty('stylesheet_name','Custom');
                                objChanged=true; 
                        }
                                obj.setProperty('stylesheet_name','Custom');
                                objChanged=true; 
                        }
-                       if (objChanged) { obj.flush(); }
+                       if (objChanged) { try { obj.flush(); } catch (e:Error) {} }
 
                        // map backdrop object
             var w:uint = map_area.width;
 
                        // map backdrop object
             var w:uint = map_area.width;