Select to view content in your preferred language

InfoWindow on Click sample integrated into Flex Viewer 2

553
0
12-23-2010 05:09 AM
CoryHines
New Contributor
Hi Everyone,

I've seen a few other posts about this functionality, and maybe it's just me, but it seems like this concept is far more complicated than it needs to be for the flex viewer.  It's seems redundant that I have to have a separate widget just to show a few fields from a layer in a map service that is already being shown.  I've attempted placing a portion of this sample code in various places and have been able to compile everything without errors, but don't get the results in the app.  Is there a place in one of the mxml's that this could be integrated into fairly easily?  Thanks again!

Cory

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

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <esri:Map openHandCursorVisible="false">
        <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...">
            <esri:symbol>
                <esri:SimpleFillSymbol id="fillsym" style="null">
                    <esri:SimpleLineSymbol width="3" color="0xFF0000"/>
                </esri:SimpleFillSymbol>
            </esri:symbol>
            <esri:infoWindowRenderer>
                <fx:Component>
                    <mx:VBox backgroundColor="0xffffff"
                             color="0x444444"
                             label="Parcel {data.PARCELID}">
                        <mx:Label text="Owner: {data.OWNERNME1}"/>
                        <mx:Label text="Address: {data.SITEADDRESS}"/>
                        <mx:Label text="Land Value: {data.LNDVALUE}"/>
                        <mx:Label text="Landuse: {data.USECD}"/>
                    </mx:VBox>
                </fx:Component>
            </esri:infoWindowRenderer>
        </esri:FeatureLayer>
    </esri:Map>

    <s:Label enabled="{fLayer.loaded}" text="Using the 'onDemand' mode, parcels are fetched 'as needed' when you pan and zoom.  Click any parcel to see more information."/>

</s:Application>
Tags (2)
0 Kudos
0 Replies