More styleparser documentation.
[potlatch2.git] / potlatch2.mxml
index 27ede9d..81dfce4 100644 (file)
@@ -7,7 +7,8 @@
        horizontalScrollPolicy="off"
        verticalScrollPolicy="off"
        horizontalAlign="center" 
-       addedToStage="initApp()">
+       addedToStage="initApp()"
+       preloader="net.systemeD.potlatch2.Preloader">
        
        <mx:Style source="styles/Application.css"/>
 
@@ -40,7 +41,8 @@
                </mx:PopUpMenuButton>
         <mx:Spacer width="100%"/>
         <mx:Button label="Undo" click="MainUndoStack.getGlobalStack().undo();" styleName="appBarButton"
-            enabled="{MainUndoStack.getGlobalStack().canUndo()}"/>
+            enabled="{MainUndoStack.getGlobalStack().canUndo()}"
+            toolTip="{MainUndoStack.getGlobalStack().getUndoDescription() ? 'Undo '+MainUndoStack.getGlobalStack().getUndoDescription() : 'Undo last action'}" />
         <mx:Button label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
             enabled="{MainUndoStack.getGlobalStack().canRedo()}"/>
         <mx:Spacer width="100%"/>
@@ -82,6 +84,7 @@
                import net.systemeD.potlatch2.options.*;
                import net.systemeD.potlatch2.utils.*;
         import net.systemeD.potlatch2.mygpx.*;
+               import net.systemeD.controls.FloatingAlert;
                import mx.managers.PopUpManager;
                import flash.system.Security;
                import flash.net.*;
             theMap.updateSize(w,h);
                        theMap.addEventListener(MapEvent.SCALE, scaleHandler);
 
-                       // add mask for map
-                       var s:Sprite=new Sprite();
-                       s.graphics.beginFill(0xFFFFFF,100);
-                       s.graphics.drawRect(0,0,w,h);
-                       s.graphics.endFill();
-                       _root.addChild(s);
-                       theMap.mask=s;
-
                        // add attribution/logo sprite
                        var overlay:Sprite=new Sprite();
                        var attribution:TextField=new TextField();
             conn.addEventListener(Connection.DATA_DIRTY, onDataDirty);
             conn.addEventListener(Connection.DATA_CLEAN, onDataClean);
                        conn.addEventListener(MapEvent.ERROR, onMapError);
-                       conn.addEventListener(MapEvent.ATTENTION, onAttention);
+                       conn.addEventListener(AttentionEvent.ATTENTION, onAttention);
+                       conn.addEventListener(AttentionEvent.ALERT, onAlert);
 
             // set the access token from saved cookie
             var tokenObject:SharedObject = SharedObject.getLocal("access_token");
 
                        // Load arbitrary GPX from provided URL
                        if (loaderInfo.parameters['gpx_url']) {
-                               var vectorlayer:VectorLayer=new VectorLayer(name,theMap,"gpx.css");
+                               var vectorlayer:VectorLayer=new VectorLayer(name,theMap,"stylesheets/gpx.css");
                                vectorlayer.url=loaderInfo.parameters['gpx_url'];
                                var gpx:GpxImporter=new GpxImporter(vectorlayer, vectorlayer.paint, [vectorlayer.url], 
                                                                    function(success:Boolean,message:String=null):void {
                        });
                }
 
-               /* Highlight an entity in response to an 'attention' event */
+               /** Highlight an entity in response to an 'attention' event */
 
-               public function onAttention(mapEvent:MapEvent):void {
-                       var entity:Entity=mapEvent.params.entity;
+               public function onAttention(event:AttentionEvent):void {
+                       var entity:Entity=event.entity;
                        if (entity is Relation) {
                                // If it's a relation, just bring up the editor panel
                                var panel:RelationEditorPanel = RelationEditorPanel(
                        theController.setState(theController.findStateForSelection([entity]));
                }
 
+               /** Display floating warning in response to an 'alert' event */
+
+               public function onAlert(event:AttentionEvent):void {
+                       var alert:FloatingAlert=new FloatingAlert(event.message);
+                       stage.addChild(alert);
+               }
+
         public function onResizeMap():void {
             if ( theMap != null )
                 theMap.updateSize(map_area.width, map_area.height);