Skip To Content

InfoWindow on Click

<?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"
               pageTitle="FeatureLayer on demand">
    <!--
    Description:
    This sample demonstrates how to add InfoWindows to a feature layer.
    When user clicks on one of the polygon features, the info window popup will show.

    Documentation:
    For more information, see the API documentation.
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/FeatureLayer.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/GraphicsLayer.html#infoWindowRenderer
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/ClassFactory.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/LabelDataRenderer.html
    -->

    <fx:Style>
        @namespace esri "http://www.esri.com/2008/ags";
        @namespace mx "library://ns.adobe.com/flex/mx";
        esri|ContentNavigator
        {
            headerColor: #FFFFFF;
            headerBackgroundAlpha: 1.0;
            headerBackgroundColor: #E90000;
        }
    </fx:Style>

    <s:controlBarContent>
        <s:RichText width="100%">
            This sample demonstrates how to add InfoWindows to a feature layer.
            When user clicks on one of the polygon features, the info window popup will show.
            Using the 'onDemand' mode, parcels are fetched 'as needed' when you pan and zoom.
            Click any parcel to see more information.
        </s:RichText>
    </s:controlBarContent>

    <esri:Map>
        <esri:extent>
            <!-- Extent for Bloomfield Hills, Michigan -->
            <esri:Extent xmin="-9271300" ymin="5247400" xmax="-9270300" ymax="5248500">
                <esri:SpatialReference wkid="102100"/>
            </esri:Extent>
        </esri:extent>
        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
        <esri:FeatureLayer id="fLayer"
                           mode="onDemand"
                           outFields="[PARCELID,OWNERNME1,SITEADDRESS,LNDVALUE,USECD]"
                           url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2">
            <esri:symbol>
                <esri:SimpleFillSymbol id="fillsym" style="null">
                    <esri:SimpleLineSymbol width="3" color="0xFF0000"/>
                </esri:SimpleFillSymbol>
            </esri:symbol>
            <esri:infoWindowRenderer>
                <fx:Component>
                    <esri:LabelDataRenderer label="Parcel {data.PARCELID}">
                        <s:VGroup paddingBottom="5"
                                  paddingLeft="5"
                                  paddingRight="5"
                                  paddingTop="5">
                            <s:Label text="Owner: {data.OWNERNME1}"/>
                            <s:Label text="Address: {data.SITEADDRESS}"/>
                            <s:Label text="Land Value: {data.LNDVALUE}"/>
                            <s:Label text="Landuse: {data.USECD}"/>
                        </s:VGroup>
                    </esri:LabelDataRenderer>
                </fx:Component>
            </esri:infoWindowRenderer>
        </esri:FeatureLayer>
    </esri:Map>

</s:Application>