read default from imagery.xml rather than using yahoodefault
authorRichard Fairhurst <richard@systemed.net>
Tue, 30 Nov 2010 17:44:11 +0000 (17:44 +0000)
committerRichard Fairhurst <richard@systemed.net>
Tue, 30 Nov 2010 17:44:11 +0000 (17:44 +0000)
net/systemeD/potlatch2/collections/Imagery.as
potlatch2.mxml

index f022e45..d27445a 100644 (file)
@@ -26,18 +26,16 @@ package net.systemeD.potlatch2.collections {
                public var collection:Array=[];
                public var selected:Object={};
 
-               private var _yahooDefault:Boolean=false;
                private var _map:Map;
                private var _overlay:Sprite;
                private var _yahoo:Yahoo;
 
                /* Load catalogue file */
 
-               public function init(map:Map, overlay:Sprite, yahoo:Yahoo, yahooDefault:Boolean):void {
+               public function init(map:Map, overlay:Sprite, yahoo:Yahoo):void {
                        _map = map;
                        _overlay = overlay;
                        _yahoo = yahoo;
-                       _yahooDefault = yahooDefault;
 
                        // load imagery file
                var request:DebugURLRequest = new DebugURLRequest("imagery.xml");
@@ -85,16 +83,19 @@ package net.systemeD.potlatch2.collections {
             }
 
                        // Automatically select the user's previous preference
+                       var defaultBackground:Object=null;
                        for each (bg in collection) {
                                if (bg.name==saved.name || bg.url==saved.url) {
                                        setBackground(bg);
                     backgroundSet = true;
+                               } else if (bg.default) {
+                                       defaultBackground=bg;
                                }
                        }
 
-            // Otherwise, set Yahoo as default (if this was passed in as an option from the embedding page)
-            if (!backgroundSet && _yahooDefault) {
-                setBackground(collection[1]);
+            // Otherwise, set whatever's specified as default
+            if (!backgroundSet && defaultBackground) {
+                setBackground(defaultBackground);
             }
 
                        // Get any attribution and logo details
index 144ea93..73da3b7 100644 (file)
                        Globals.vars.map_area.addEventListener(MouseEvent.MOUSE_DOWN, theMap.mouseDownHandler);
 
                        // initialise imagery and stylesheets
-                       Imagery.instance().init(theMap, overlay, yahoo, loaderInfo.parameters['yahoo_default'] == 'true');
+                       Imagery.instance().init(theMap, overlay, yahoo);
                        Stylesheets.instance().init(theMap);
                        Imagery.instance().addEventListener(MapEvent.BUMP, bumpHandler);