Register a setPosition function that can be used from javascript to
authorTom Hughes <tom@compton.nu>
Tue, 30 Nov 2010 12:59:53 +0000 (12:59 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 30 Nov 2010 12:59:53 +0000 (12:59 +0000)
adjust the map view.

net/systemeD/halcyon/Map.as

index e168ec342dcf669c11a849195601e1f2ca4c2151..4aae32a29e90323eb996fb261f9d067452a774c2 100644 (file)
@@ -12,6 +12,7 @@ package net.systemeD.halcyon {
        import flash.utils.ByteArray;
        import flash.events.*;
        import flash.net.*;
+    import flash.external.ExternalInterface;
 
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.halcyon.connection.EntityEvent;
@@ -145,7 +146,11 @@ package net.systemeD.halcyon {
                        updateCoords(0,0);
             this.dispatchEvent(new Event(MapEvent.INITIALISED));
                        download();
-                       
+
+            ExternalInterface.addCallback("setPosition", function (lat:Number,lon:Number,zoom:uint):void {
+                updateCoordsFromLatLon(lat, lon);
+                changeScale(zoom);
+            });
         }
 
                // ------------------------------------------------------------------------------------------