Load policy files only when the layer is created - often the loader can be created...
authorAndy Allan <gravitystorm@gmail.com>
Fri, 26 Nov 2010 14:49:26 +0000 (14:49 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Fri, 26 Nov 2010 14:49:26 +0000 (14:49 +0000)
net/systemeD/potlatch2/utils/BikeShopLoader.as
net/systemeD/potlatch2/utils/BugLoader.as

index b9ff202..f19f155 100644 (file)
@@ -30,9 +30,6 @@ package net.systemeD.potlatch2.utils {
         public function BikeShopLoader(map:Map, url:String) {
             this.map = map;
             this.bikeShopBaseURL = url;
-            var policyFile:String = bikeShopBaseURL+"crossdomain.xml";
-            trace(policyFile)
-            Security.loadPolicyFile(policyFile);
         }
 
         public function load():void {
@@ -69,6 +66,10 @@ package net.systemeD.potlatch2.utils {
         private function get layer():VectorLayer {
             if (!_layer) {
                 var n:String='Bike Shops';
+
+                var policyFile:String = bikeShopBaseURL+"crossdomain.xml";
+                Security.loadPolicyFile(policyFile);
+
                 _layer=new VectorLayer(n,map,STYLESHEET);
                 map.addVectorLayer(_layer);
             }
index bebd7db..ac4cb1a 100644 (file)
@@ -21,8 +21,6 @@ package net.systemeD.potlatch2.utils {
             this.map = map;
             this.bugBaseURL = url;
             this.bugApiKey = bugApiKey;
-            var policyFile:String = bugBaseURL+"crossdomain.xml";
-            Security.loadPolicyFile(policyFile);
         }
 
         public function load():void {
@@ -33,6 +31,10 @@ package net.systemeD.potlatch2.utils {
         private function get layer():VectorLayer {
             if (!_layer) {
                 var n:String='Bugs';
+
+                var policyFile:String = bugBaseURL+"crossdomain.xml";
+                Security.loadPolicyFile(policyFile);
+
                 _layer=new BugLayer(n,map,STYLESHEET,bugBaseURL,bugApiKey);
                 map.addVectorLayer(_layer);
             }