Select to view content in your preferred language

Replace "Powered by ESRI" logo in Flex Viewer 3.6

3461
3
Jump to solution
09-04-2014 09:28 AM
BingJing
Regular Contributor

In this discussion.  I tried the code but it did not workreplace powered by ESRI

Hope you can help out.

This is my code (mapmanager.mxml).  It has no compile error, but it does not work.

If I use below code,

for (var i:int=0; i<map.staticLayer.numChildren; i++)

then it errored out.

So I use

for (var i:int=0; i<map.numChildren; i++)

There are 3 numChildren in my case.

But then, debug shows "img" is null.

????

import mx.controls.Image; //

import mx.core.UIComponent; //BJ 8/20/2014

...

[Embed(source="assets/images/carsonlogo.png")]

private var myLogo:Class;

....

////////////////////////////////////////////////////////////////////////////////////////

private function changeESRILogo(map:Map):void  

  { 

  for (var i:int=0; i<map.numChildren; i++){ 

  var component:UIComponent = map.getChildAt(i) as UIComponent; 

  if (component!=null)

  {

    //if(component.className == "StaticLayer"){ 

  for(var j:int = 0 ; j < component.numChildren ; j++) 

  { 

  var stComponent:UIComponent = component.getChildAt(j) as UIComponent; 

  if(stComponent.className == "Image") 

  { 

  var img:Image = stComponent as Image;

  if (img!=null)

  {

  if (img.source.toString().indexOf("logo") > 0) 

  { 

  img.source = myLogo; 

  img.addEventListener(MouseEvent.MOUSE_DOWN ,gotoMyURL,false,1000); 

  return; 

  }

  }

  } 

  }

  }//null

  }//  for

  } 

//////////////////////////////////////////////////////////////////

protected override function partAdded(partName:String, instance:Object):void

            {

                super.partAdded(partName, instance);

                if (instance == map)

                {

                    var cssStyleDeclaration:CSSStyleDeclaration = styleManager.getStyleDeclaration("com.esri.ags.components.supportClasses.InfoWindow")

                    cssStyleDeclaration.setStyle("backgroundColor", getStyle('contentBackgroundColor'));

                    styleManager.setStyleDeclaration("com.esri.ags.components.supportClasses.InfoWindow", cssStyleDeclaration, true);

  map.zoomSliderVisible = false; 

  //map.addEventListener(MapEvent.LOAD, mapLoadComplete);       

  changeESRILogo(map);

                }

            }

Thank you very much....

0 Kudos
1 Solution

Accepted Solutions
AnthonyGiles
Honored Contributor

If you are using the flex viewer it is easier just to add the attribute esrilogovisible="false" to the map tag in the main config file to hide the logo:

ArcGIS Viewer for Flex

then use the static image widget to add your own logo:

ArcGIS Viewer for Flex

no coding required

regards

anthony

View solution in original post

0 Kudos
3 Replies
AnthonyGiles
Honored Contributor

If you are using the flex viewer it is easier just to add the attribute esrilogovisible="false" to the map tag in the main config file to hide the logo:

ArcGIS Viewer for Flex

then use the static image widget to add your own logo:

ArcGIS Viewer for Flex

no coding required

regards

anthony

0 Kudos
BingJing
Regular Contributor

Thank you very much.

I tried StaticImage Widget and it worked! So is everybody using this, instead of trying to coding it in MapManager.mxml? *( Still wonder why the code does not work though...)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bing Jing,

  So the same exact code will work in the latest viewer if you change the image import to

import spark.components.Image;

instead of

import mx.controls.Image;

0 Kudos