make logo clickable
authorRichard Fairhurst <richard@systemed.net>
Tue, 30 Nov 2010 01:03:19 +0000 (01:03 +0000)
committerRichard Fairhurst <richard@systemed.net>
Tue, 30 Nov 2010 01:03:19 +0000 (01:03 +0000)
net/systemeD/potlatch2/collections/Imagery.as
resources/bing_maps.png

index 4cc2f9e..7a407c9 100644 (file)
@@ -1,7 +1,6 @@
 package net.systemeD.potlatch2.collections {
 
-       import flash.events.EventDispatcher;
-       import flash.events.Event;
+       import flash.events.*;
        import flash.display.*;
        import flash.net.*;
        import flash.text.TextField;
@@ -213,10 +212,16 @@ package net.systemeD.potlatch2.collections {
                private function setLogo():void {
                        if (!selected.logoData) return;
                        while (_overlay.numChildren>1) { _overlay.removeChildAt(1); }
-                       var logo:Bitmap=new Bitmap(selected.logoData);
+                       var logo:Sprite=new Sprite();
+                       logo.addChild(new Bitmap(selected.logoData));
                        logo.x=5; logo.y=_map.mapheight-5-selected.logoHeight;
+                       if (selected.logo_url) { logo.buttonMode=true; logo.addEventListener(MouseEvent.CLICK, launchLogoLink, false, 0, true); }
                        _overlay.addChild(logo);
                }
+               private function launchLogoLink(e:Event):void {
+                       if (!selected.logo_url) return;
+                       navigateToURL(new URLRequest(selected.logo_url), '_blank');
+               }
 
                [Bindable(event="collection_changed")]
                public function getAvailableImagery():ArrayCollection {
index ae4367e..bbc4b1d 100644 (file)
Binary files a/resources/bing_maps.png and b/resources/bing_maps.png differ