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....
Solved! Go to Solution.
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:
then use the static image widget to add your own logo:
no coding required
regards
anthony
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:
then use the static image widget to add your own logo:
no coding required
regards
anthony
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...)
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;