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....