Very basic map event support, plus calculate area centroids correctly.
[potlatch2.git] / halcyon.mxml
index ec1c18ca3be54a22fe5b1afa82f4e6ded82f6276..23d8a7290fe4b5eab433a5cd04b46be462ee69dc 100755 (executable)
@@ -6,15 +6,9 @@
        horizontalAlign="center" 
        addedToStage="initApp()">
 
-<!--    <halcyon:CountryComboBox /> -->
-
-<!--   <halcyon:Map width="400" height="200" id="theMap" /> -->
-<!-- applicationComplete -->
-<!-- rawChildren -->
-
     <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>
@@ -29,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; 
-                       //t.multiline=true;
-                       //_root.addChild(t);
+                       t.width=400; t.height=100; t.border=true; 
+                       t.multiline=true;
+                       _root.addChild(t);
                        Globals.vars.debug=t;
                }