I've not actually looked at the viewer for some time but perhaps should at some point.
Maybe you already know, but that is what the Bookmark Widget in the ArcGIS Viewer for Flex does.
package org.larimer { import flash.net.SharedObject; public class ApplicationSettings { // module level vars private static var _instance:ApplicationSettings; private var _so:SharedObject; // constructor public function ApplicationSettings(enforcer:SingletonEnforcer) { _so = SharedObject.getLocal("applicationSettings"); } public static function getInstance():ApplicationSettings { if(ApplicationSettings._instance == null) { ApplicationSettings._instance = new ApplicationSettings(new SingletonEnforcer()); } return _instance; } // public properties // scale public function get scale():Number { return _so.data.scale; } public function set scale(value:Number):void { _so.setProperty("scale", value); } //more properties ... } } class SingletonEnforcer{}
private var _applicationSettings:ApplicationSettings = ApplicationSettings.getInstance();
_applicationSettings.scale = map.scale;
map.scale = _applicationSettings.scale;
Next SharedObject task... bookmarks.-r
Ok, the SharedObject class works very well. I created an "ApplicationsSettings" class that sets/gets all the appropriate values throughout the app. That class then manages the SharedObject. Then when the app loads in subsequent sessions, it checks the applicationsSettings properties and applies them where needed. I now have an app that holds all the map settings (scale, layers turned on, map center, other settings) between sessions, if the user turns that feature on. When the user turns that off, the app clears the SharedObject (through the ApplicationSettings class) and sets all app settings back to defaults.Next SharedObject task... bookmarks.Very nice.Thanks again Dasa.-r
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.