<!-- 設置地圖控件的crosshair樣式; 徹底刪除Esri的logo -->
<!-- Copyright (c) 2010-2011 《ArcGIS Server開發指南——基於Flex和.NET》練習代碼
完整的代碼工程可以從 http://www.geocommon.net 下載 -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="655" minHeight="500"
xmlns:esri="http://www.esri.com/2008/ags">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<esri:Map id="map" openHandCursorVisible="true" panDuration="6000"
load="loaded();" crosshairVisible="true" logoVisible="false">
<esri:ArcGISDynamicMapServiceLayer
url="http://localhost/ArcGIS/rest/services/Florida/MapServer" />
</esri:Map>
<fx:Script>
<![CDATA[
import com.esri.ags.events.ZoomEvent;
import mx.controls.Alert;
import mx.core.UIComponent;
private function loaded():void
{
map.setStyle("crosshairLength",15);
map.setStyle("crosshairWidth",1);
map.setStyle("crosshairColor",0xff0000);
map.setStyle("crosshairAlpha",0.8);
}
private function RemoveLogo():void
{
for(var i:Number=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"){
stComponent.visible = false;
return;
}
}
}
}
}
}
]]>
</fx:Script>
</s:Application>