首页 > 代码库 > 基于flex4 鹰眼的代码编写

基于flex4 鹰眼的代码编写

<?xml version="1.0" encoding="utf-8"?>
<!-- 鹰眼  -->
<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"
               xmlns:esri="http://www.esri.com/2008/ags"
               minWidth="655" minHeight="400">
    <fx:Declarations>
        <esri:SimpleFillSymbol id="fillsym" color="#ff0000" />
    </fx:Declarations>
    <esri:Map id="map" width="100%" height="100%"
              extentChange="onExtentChanged();">
        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
    </esri:Map>
    <s:BorderContainer id="overview" width="180" height="180" right="0" bottom="0"
                       borderAlpha="0.5" borderColor="#000000" backgroundAlpha="0.6" visible="false">
        <esri:Map id="overviewmap" panEnabled="false" scaleBarVisible="false"
                  width="100%" height="100%"
                  logoVisible="false" zoomSliderVisible="false">
            <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
            <esri:GraphicsLayer id="rectlayer">
                <esri:graphicProvider>
                    <esri:Graphic id="rect" symbol="{fillsym}" />
                </esri:graphicProvider>
            </esri:GraphicsLayer>
        </esri:Map>
    </s:BorderContainer>   
    <mx:Image id="overviewimage" source="assets/images/show.png" bottom="0" click="toggleOverView();" right="0" useHandCursor="true" buttonMode="true" />
    <fx:Script>
        <![CDATA[                   
            private function onExtentChanged():void
            {
                rect.geometry = map.extent;
            }               
            private function toggleOverView():void
            {
                if(overview.visible)
                {                   
                    overviewimage.source = "assets/images/show.png";
                }
                else
                {                   
                    overviewimage.source = "assets/images/hide.png";
                }                   
                overview.visible = !overview.visible;
            }               
        ]]>
    </fx:Script>
</s:Application>