Very basic map event support, plus calculate area centroids correctly.
[potlatch2.git] / halcyon.mxml
index dd09029d814ae9d29b59f793820862119c8e33bf..23d8a7290fe4b5eab433a5cd04b46be462ee69dc 100755 (executable)
@@ -8,7 +8,7 @@
 
     <mx:HDividedBox width="100%" height="100%">
 
-      <mx:VBox height="100%">
+      <mx:VBox height="50%">
         <mx:Button label="+" click="theMap.zoomIn();"/>
         <mx:Button label="-" click="theMap.zoomOut();"/>
       </mx:VBox>
@@ -23,6 +23,7 @@
                import flash.display.Sprite;
                import mx.core.IChildList;
         import mx.containers.Canvas;
+               import mx.core.Application;
 
         public var theMap:Map;
 
             var b:Canvas = new Canvas();
             b.height=200; b.width=200;
             b.setStyle("backgroundColor", 0xFFFFEA);
-                       //var b:Sprite=new Sprite();
-                       //b.graphics.beginFill(0xFFFFEA,100);
-                       //b.graphics.drawRect(0,0,200,200);
-                       //b.graphics.endFill();
                        _root.addChild(b);
 
                        // add map
                        // keyboard event attached to stage
                        stage.addEventListener(KeyboardEvent.KEY_UP, theMap.keyUpHandler);
 
+                       // example listener event
+                       var myListenerObj:Object = new Object();
+                       myListenerObj.mapHandler=function(event:MapEvent):void {
+                               Globals.vars.debug.appendText("Download event fired - "+event.minlat+","+event.minlon+"\n");
+                       };
+                       theMap.addEventListener(MapEvent.DOWNLOAD, myListenerObj.mapHandler);
+
                        // add debug field
                        var t:TextField=new TextField();
                        t.width=400; t.height=100; t.border=true;