Select to view content in your preferred language

How to use infoWindowRenderer in ActionScript vs MXML?

2476
2
11-20-2010 09:07 AM
SteveMcKinney
New Contributor
Hi all,

I need some assistance in using the infoWindowRenderer in ActionScript instead of MXML.

The MXML file attached is a modified version of the sample "InfoWindows for FeatureLayer" that accomplishes my goal with MXML, but I can't figure out how to change it to ActionScript.  I want to do this to help create a simple widget for Flexviewer v2.1.

Thanks in advance for the assistance!

Steve McKinney
SICS Consultants, LLC
steve@sicsconsultants.com

PS
Specifically I am trying to implement the following as ActionScript;

  <esri:FeatureLayer outFields="*"
         url="http://gis.sicsconsultants.ws/ArcGIS/rest/services/Hospital_Master/MapServer/0">
   <esri:infoWindowRenderer>
    <fx:Component>
     <mx:VBox label="{data.Name}"
        height="300"
        horizontalScrollPolicy="off"
        verticalScrollPolicy="on"
        >
      <fx:Script>
       <![CDATA[
        import flash.net.navigateToURL;
       ]]>
      </fx:Script>
     <mx:Grid width="100%">
      <mx:GridRow>
       <mx:GridItem><s:Label text="OBJECTID"/> </mx:GridItem>
       <mx:GridItem><s:Label text="{data.OBJECTID}"/></mx:GridItem>
      </mx:GridRow>     
      <mx:GridRow>
       <mx:GridItem><s:Label text="ID"/> </mx:GridItem>
       <mx:GridItem><s:Label text="{data.id}"/></mx:GridItem>
      </mx:GridRow>
      <mx:GridRow>
       <mx:GridItem><s:Label text="Provider"/> </mx:GridItem>
       <mx:GridItem><s:Label text="{data.provider}"/></mx:GridItem>
      </mx:GridRow>    
     </mx:Grid>      
     </mx:VBox>      
    </fx:Component>
   </esri:infoWindowRenderer>

  </esri:FeatureLayer>
Tags (2)
0 Kudos
2 Replies
DasaPaddock
Esri Regular Contributor
You can put the VBox in its own mxml file and then use a ClassFactory to create an IFactory instance that can be set on the infoWindowRenderer property.

See:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/ClassFactory.html

If you named the mxml file, MyRenderer.mxml, it'd look like this:

    myFeatureLayer.infoWindowRenderer = new ClassFactory(MyRenderer);
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Steve,

  Here is some ActionScript code to do just like Dasa is talking about. Attached is a infoRenderer component that allows you to define the fields that will be displayed in the ActionScript code. It is a little rough (i.e. fields are not displayed in the order they are specified in the code but you can get the picture)
0 Kudos