Allow more than one imagery source to have a logo
authorRichard Fairhurst <richard@systemeD.net>
Fri, 30 Sep 2011 14:55:06 +0000 (15:55 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Fri, 30 Sep 2011 14:55:06 +0000 (15:55 +0100)
net/systemeD/potlatch2/collections/Imagery.as

index b9a42aa..f8abb7c 100644 (file)
@@ -95,12 +95,11 @@ package net.systemeD.potlatch2.collections {
             }
 
                        // Get any attribution and logo details
             }
 
                        // Get any attribution and logo details
-                       for each (bg in collection) {
+                       collection.forEach(function(bg:Object, index:int, array:Array):void {
                                if (bg.logo) {
                                        // load the logo
                                        var loader:Loader = new Loader();
                                if (bg.logo) {
                                        // load the logo
                                        var loader:Loader = new Loader();
-                                       var thisbg1:Object = bg;                        // scope it for the closure
-                                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void { onLogoLoad(e,thisbg1); });
+                                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void { onLogoLoad(e,bg); });
                                        loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                        loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
                                        loader.load(new URLRequest(bg.logo));
                                        loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                        loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
                                        loader.load(new URLRequest(bg.logo));
@@ -108,13 +107,12 @@ package net.systemeD.potlatch2.collections {
                                if (bg.attribution_url) {
                                        // load the attribution
                                var urlloader:URLLoader = new URLLoader();
                                if (bg.attribution_url) {
                                        // load the attribution
                                var urlloader:URLLoader = new URLLoader();
-                                       var thisbg2:Object = bg;                        // scope it for the closure
-                                       urlloader.addEventListener(Event.COMPLETE, function(e:Event):void { onAttributionLoad(e,thisbg2); });
+                                       urlloader.addEventListener(Event.COMPLETE, function(e:Event):void { onAttributionLoad(e,bg); });
                                        urlloader.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                        urlloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
                                urlloader.load(new URLRequest(bg.attribution_url));
                                }
                                        urlloader.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                        urlloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
                                urlloader.load(new URLRequest(bg.attribution_url));
                                }
-                       }
+                       });
 
                        // Tell the function key manager that we'd like to receive function key calls
                        FunctionKeyManager.instance().registerListener('Background imagery',
 
                        // Tell the function key manager that we'd like to receive function key calls
                        FunctionKeyManager.instance().registerListener('Background imagery',