replace powered by ESRI

8133
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
RobertScheitlin__GISP
MVP Emeritus
Joshua,


   To add code boxes click the # button on the buttons above the window where you type.
0 Kudos
JoshuaCoates
Deactivated User
<?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;
            import mx.events.CloseEvent;
            import mx.resources.ResourceManager;
            import mx.controls.Image;
            
            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_bartow.png")]
            private var myLogo:Class;
            
            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://www.bartowga.org/gis/index.html");
                navigateToURL(myURL);
                evt.stopPropagation();
            }
            
            //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);  
                    changeESRILogo(map);                    
                }
            }
            
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Joshua

   Uncomment this line
//[Embed(source="assets/images/i_bartow.png")]

should be
[Embed(source="assets/images/i_bartow.png")]
0 Kudos
JoshuaCoates
Deactivated User
Good deal! I have the new image, however, it still is linked to ESRI's web page?!
0 Kudos
deleted-user-rQoEFM5qzbHE
Deactivated User
To coalesce everything into one post, here is what I did (based on Robert's help)

Added the following lines of code to the 'import' section:
import mx.core.UIComponent
import mx.controls.Image


Then I added the following lines, just after the last 'private var...' line.

[Embed(source="assets/images/NEW_ITRE_LOGO1.png")]
            private var myLogo:Class;


In order to get the above to work properly, I had to add a semi-colon to the end of the following line, and then an extra vertical space.
private var optLayerTable:Array = new Array();


Next, I added the following function (for version 2.0):
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;
                        }
                    }
                }
            }


Now, instead of making the call to the partAdded function from the gotoMyURL, I made it from the mapLoadComplete function.

I think that is everything I did, if I left something out let me know. If I can be of any further help, also let me know since this is pretty fresh in my memory.
0 Kudos
JoshuaCoates
Deactivated User
That is everything I have done....I have my image showing up, it is still linking me to the ESRI web page though. I have my url in the:
private function gotoMyURL(evt:Event):void
            {
                var myURL:URLRequest = new URLRequest("http://www.bartowga.org/gis/index.html");
                navigateToURL(myURL);
                evt.stopPropagation();
            }


and my call is from:
protected override function partAdded(partName:String, instance:Object):void
            {
                super.partAdded(partName, instance);
                if (instance == map)
                {
                    map.zoomSliderVisible = false;
                    map.addEventListener(MapEvent.LOAD, mapLoadComplete);  
                    changeESRILogo(map);                    
                }
            }


any reason why my web page wont link the the image?
0 Kudos
deleted-user-rQoEFM5qzbHE
Deactivated User
I am kind of having an issue with that as well. Once I click on the link, our website opens. Then, ESRI's website opens in a new window. So, they both open but there is only one link showing in the code.
0 Kudos
JoshuaCoates
Deactivated User
Also, is there any reason why after making these modifications to the MapManager.mxml that my OverviewMap in the lwoer right would get messed up? When I click it...it pulls up and is shaded pink...and if you move around in it...it moves the actual map instead of just going to the area? But when I am zoomed in the map...it works as it is suppose to? I dont know if this could have to do with me creating caches for my maps yesterday...and I have not recreated the services for them yet?! SO i know some other things have gone out of whack since I created the caches. (i.e. if you open a layer in the Layer List widget...there are no longer check boxes to turn sub layers on or off)
0 Kudos
JoshuaCoates
Deactivated User
Yes, that is what mine is doing as well. Both my website and the ESRI website opens. ?!
0 Kudos
deleted-user-rQoEFM5qzbHE
Deactivated User
Joshua,

I don't know that there is an issue with the Overview map. Mine does the same thing, and I guess that is what I thought it was supposed to do. But, since I didn't mess with it before making all these changes, I don't know what it did before.

Regarding the issue with no sub layers showing up next to a map service in the layer list if that happens for us, it usually means that the server has most likely gone down. I usually check and refresh and the option to add sub layers comes back. It doesn't seem like an issue with the code as much as it is with our server (at least in our case).
0 Kudos