Wrap ExternalInterface call in test - not all players support it
authorAndy Allan <gravitystorm@gmail.com>
Tue, 30 Nov 2010 15:52:41 +0000 (15:52 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Tue, 30 Nov 2010 15:52:41 +0000 (15:52 +0000)
net/systemeD/halcyon/Map.as

index 2a91e87..8a95181 100644 (file)
@@ -150,10 +150,12 @@ package net.systemeD.halcyon {
             this.dispatchEvent(new Event(MapEvent.INITIALISED));
                        download();
 
-            ExternalInterface.addCallback("setPosition", function (lat:Number,lon:Number,zoom:uint):void {
-                updateCoordsFromLatLon(lat, lon);
-                changeScale(zoom);
-            });
+            if (ExternalInterface.available) {
+              ExternalInterface.addCallback("setPosition", function (lat:Number,lon:Number,zoom:uint):void {
+                  updateCoordsFromLatLon(lat, lon);
+                  changeScale(zoom);
+              });
+            }
         }
 
                // ------------------------------------------------------------------------------------------