replace powered by ESRI

7342
70
07-22-2010 02:01 AM
NatashaManzuiga
Regular Contributor
Hi all I perfectly replaced ESRI logo with this script:
http://forums.esri.com/thread.asp?t=287497&f=2421&c=158#912795
Now how can I replace link to esri.com/flex?

Naty
Tags (2)
0 Kudos
70 Replies
DasaPaddock
Esri Regular Contributor
In your gotoMyURL() try:
    evt.stopImmediatePropagation()
instead of:
    evt.stopPropagation();
0 Kudos
deleted-user-rQoEFM5qzbHE
Deactivated User
That doesn't seem to have any affect. I noticed that if you look closely as the page is loading, the "Powered by ESRI" logo is there and then gets covered up. It seems the function used doesn't replace the old logo but rather just lays on top so that when you click it you are clicking both, hence cause both websites to open.
0 Kudos
DasaPaddock
Esri Regular Contributor
In version 2.0 of the API, you should really just hide the ESRI logo and add a new Image to the Map.staticLayer Group. This way there's no conflict. To hide the ESRI logo, set Map.logoVisible to false.

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/Map.html#staticLayer
0 Kudos
JoshuaCoates
Deactivated User
I'm not seeing "Map.logoVisible or Map.staticLayer Group"?!
0 Kudos
DasaPaddock
Esri Regular Contributor
They're not static properties, so you'll need to access them on your Map instance.
0 Kudos
JoshuaCoates
Deactivated User
Sorry, I have no idea what you are talking about. I struggle communicating with you programmers. 😞 I was told FLEX was so easy that people who know no code could do it. Not finding this to be very true. Thank you for trying though.
0 Kudos
deleted-user-rQoEFM5qzbHE
Deactivated User
Dasa,

I am not sure that is the issue. I entered the map.logoVisible = false statement into the mapLoadComplete function. It now makes my logo invisible, but the original ESRI logo still pops up for a second and then disappears. There seems to be some place in the code that is still telling it to show the logo (if only briefly).

Thanks for pointing out how to make the logo invisible.
0 Kudos
DasaPaddock
Esri Regular Contributor
The default for logoVisible is true, so you'll need to set it to false sooner than mapLoadComplete. Try MapManager.partAdded().
0 Kudos
JoshuaCoates
Deactivated User
I am looking in the MapManager.mxml and I am not seeing where it shows logoVisible:true or MapManager.partAdded()? Where do I find these? Jeff, can you show me your mxml once you do this?
0 Kudos
deleted-user-rQoEFM5qzbHE
Deactivated User
You want to put that line of code in the partAdded() funtion in the MapManager.mxml. In my code it is just below the init() function which is just below the last private var statement. Here is the code up to and including the partAdded() function.

<?xml version="1.0" encoding="utf-8"?>
<!--
     ////////////////////////////////////////////////////////////////////////////////
     //
     // Copyright (c) 2010 ESRI
     //
     // All rights reserved under the copyright laws of the United States.
     // You may freely redistribute and use this software, with or
     // without modification, provided you include the original copyright
     // and use restrictions.  See use restrictions in the file:
     // <install location>/License.txt
     //
     ////////////////////////////////////////////////////////////////////////////////
-->
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      creationComplete="init()"
                      height="100%"
                      skinClass="com.esri.viewer.skins.MapManagerSkin"
                      width="100%">
    <fx:Metadata>
        [ResourceBundle("ViewerStrings")]
    </fx:Metadata> 
    
    

    <fx:Script>
        <![CDATA[
            import com.esri.ags.Graphic;
            import com.esri.ags.Map;
            import com.esri.ags.SpatialReference;
            import com.esri.ags.TimeExtent;
            import com.esri.ags.events.DrawEvent;
            import com.esri.ags.events.ExtentEvent;
            import com.esri.ags.events.FlareEvent;
            import com.esri.ags.events.FlareMouseEvent;
            import com.esri.ags.events.GraphicEvent;
            import com.esri.ags.events.LayerEvent;
            import com.esri.ags.events.MapEvent;
            import com.esri.ags.geometry.Extent;
            import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
            import com.esri.ags.layers.ArcGISImageServiceLayer;
            import com.esri.ags.layers.ArcGISTiledMapServiceLayer;
            import com.esri.ags.layers.FeatureLayer;
            import com.esri.ags.layers.GraphicsLayer;
            import com.esri.ags.layers.Layer;
            import com.esri.ags.layers.supportClasses.StaticLayer_m_esriLogo;
            import com.esri.ags.layers.supportClasses.StaticLayer_m_globe;
            import com.esri.ags.tools.DrawTool;
            import com.esri.ags.tools.NavigationTool;
            import com.esri.ags.virtualearth.VETiledLayer;
            import com.esri.viewer.AppEvent;
            import com.esri.viewer.BaseWidget;
            import com.esri.viewer.ConfigData;
            import com.esri.viewer.IInfowindowTemplate;
            import com.esri.viewer.ViewerContainer;
            import com.esri.viewer.components.InfoPopup;
            
            import flash.utils.setInterval;
            
            import mx.collections.ArrayCollection;
            import mx.containers.Canvas;
            import mx.controls.Alert;
            import mx.core.UIComponent; // This is needed to change ESRI logo to ITRE logo
            import mx.events.CloseEvent;
            import mx.resources.ResourceManager;
            import mx.controls.Image; // This is needed to change ESRI logo to ITRE logo
            
            import spark.components.Group;

            /* skin section */
            [SkinPart(required="false")]
            public var managerView:Group;

            [SkinPart(required="false")]
            public var map:Map;

            [Bindable]
            public var mapLeft:Number = 0;

            [Bindable]
            public var mapRight:Number = 0;

            [Bindable]
            public var mapTop:Number = 0;

            [Bindable]
            public var mapBottom:Number = 0;

            [SkinState("decorated")]
            [SkinState("resized")]
            [SinkState("normal")]

            private var configData:ConfigData;

            private var defaultstatus:String;

            //[SkinPart(required="false")]
            private var infoPopup:InfoPopup;

            private var navTool:NavigationTool;

            private var drawTool:DrawTool;

            private var drawEndFunction:Function;

            private var fullExtent:Extent;

            private var _manManagerSate:String = "resized";

            private var proxyEnabled:Boolean = false;

            private var optLayerTable:Array = new Array();
            
                
            [Embed(source="assets/images/i_wind.png")]
            private var myLogo:Class;
            
            // This is the code to change the ESRI logo to ITRE's logo. In addition to this function, two import statements are needed. 
            // Also, this function should be called from the mapLoadComplete() function.
            private function changeESRILogo(map:Map):void 
            {
                for (var i:int=0; i<map.staticLayer.numChildren; i++){
                    var component:UIComponent = map.staticLayer.getChildAt(i) as UIComponent;
                    
                    if(component.className == "Image"){
                        var img:Image = component as Image;
                        if (img.source.toString().indexOf("logo") > 0){
                            img.source = myLogo;
                            img.addEventListener(MouseEvent.MOUSE_DOWN ,gotoMyURL,false,1000);
                            return;
                        }
                    }
                }
            }
            
            private function gotoMyURL(evt:Event):void
            {
                var myURL:URLRequest = new URLRequest("http://vams.itre.ncsu.edu");
                navigateToURL(myURL);
                evt.stopImmediatePropagation()
            }
            
            //init
            private function init():void
            {
                ViewerContainer.addEventListener(AppEvent.CONFIG_LOADED,        config);
                ViewerContainer.addEventListener(AppEvent.SET_MAP_NAVIGATION,   changeNavigationbyMenu);
                ViewerContainer.addEventListener(AppEvent.BASEMAP_SWITCH,       basemapMenuClicked);
                ViewerContainer.addEventListener(AppEvent.SET_MAP_ACTION,       enableMapAction);
                ViewerContainer.addEventListener(AppEvent.SHOW_INFOWINDOW,      widgetShowInfo);
                ViewerContainer.addEventListener(AppEvent.MAP_RESIZE,           resizeMap);
                ViewerContainer.addEventListener(AppEvent.DATA_OPT_LAYERS,      sendOptlayers);
                ViewerContainer.addEventListener(AppEvent.MAP_LAYER_VISIBLE,    changeLayerVisible);
            }

            protected override function partAdded(partName:String, instance:Object):void
            {
                super.partAdded(partName, instance);
                if (instance == map)
                {
                    map.zoomSliderVisible = false;
                    map.addEventListener(MapEvent.LOAD, mapLoadComplete); 
                    // This call changes the ESRI logo to ITRE's logo
                    changeESRILogo(map);
                    
                }
            }


Again, this still doesn't solve the issue of opening both the link to our website as well as ESRI.com. I am still trying to figure out how to fix that issue.
0 Kudos