Load imagery logos through FileBank
authorTom Hughes <tom@compton.nu>
Sat, 24 Mar 2012 19:34:30 +0000 (19:34 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 25 Mar 2012 11:46:47 +0000 (12:46 +0100)
net/systemeD/potlatch2/collections/Imagery.as

index 61b6019..069ae67 100644 (file)
@@ -95,11 +95,12 @@ package net.systemeD.potlatch2.collections {
                        collection.forEach(function(bg:Object, index:int, array:Array):void {
                                if (bg.logo) {
                                        // load the logo
-                                       var loader:Loader = new Loader();
-                                       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));
+                    FileBank.getInstance().addFromFile(bg.logo, function (fb:FileBank, name:String):void {
+                        bg.logoData = fb.getAsBitmapData(name);
+                        bg.logoWidth = fb.getWidth(name);
+                        bg.logoHeight = fb.getHeight(name);
+                        setLogo();
+                    });
                                }
                                if (bg.attribution_url) {
                                        // load the attribution
@@ -121,13 +122,6 @@ package net.systemeD.potlatch2.collections {
                        // placeholder error routine so exception isn't thrown
                }
                
-               public function onLogoLoad(e:Event, bg:Object):void {
-                       bg.logoData  = Bitmap(LoaderInfo(e.target).content).bitmapData;
-                       bg.logoWidth = e.target.loader.width;
-                       bg.logoHeight= e.target.loader.height;
-                       setLogo();
-               }
-               
                public function onAttributionLoad(e:Event,bg: Object):void {
                        // if we ever need to cope with non-Microsoft attribution, then this should look at bg.scheme
             default xml namespace = Namespace("http://schemas.microsoft.com/search/local/ws/rest/v1");