Merge pull request #31 from gravitystorm/errors
[potlatch2.git] / potlatch2.mxml
index 90b8932f0d53f4249b5129e8b6efacc30227f2a7..279d08f947299aeaa363d48fbe8c78aeaeaab0aa 100644 (file)
                import net.systemeD.potlatch2.utils.*;
         import net.systemeD.potlatch2.mygpx.*;
                import net.systemeD.controls.FloatingAlert;
+               import net.systemeD.controls.Spinner;
                import mx.managers.PopUpManager;
                import flash.system.Security;
                import flash.net.*;
 
                private var savecount:uint=0;
                private var loadcount:uint=0;
+               private var spinner:Spinner;
                private var saveLabel:String='Save';
                private var saveTimer:Timer;
 
             // Auto-load vector backgrounds from config
             theMap.addEventListener(MapEvent.INITIALISED, function(e:Event):void { VectorBackgrounds.instance().init(theMap); });
 
+                       // Add loading 'spinner' indicator
+                       spinner=new Spinner();
+                       _root.addChild(spinner);
+                       spinner.x=dataWorking.x-20;
+                       spinner.y=dataWorking.y+dataWorking.height/2;
+
                        // Set start position of map
                        // ** FIXME: if lat/lon/zoom aren't supplied, we need to keep the map in a non-loading state 
                        //           until the user has decided where to start editing (e.g. when the first GPX loads)
                        else if (savecount>0)           { t="Saving data..."; }
                        else                            { t=""; }
                        dataWorking.text=t.replace("#",(loadcount>1) ? (" ("+loadcount+")") : "");
-                       dataWorking.visible=(dataWorking.text!="");
+
+                       var previousState:Boolean=dataWorking.visible;
+                       var newState:Boolean=(dataWorking.text!="");
+                       if (!previousState && newState) spinner.start();
+                       if (previousState && !newState) spinner.stop();
+                       dataWorking.visible=newState;
                }
         private function onDataDirty(event:Event):void {
                        saveButton.enabled=true;