Select to view content in your preferred language

Flex 2.3 Pop-Ups

1009
3
04-17-2011 06:17 PM
JoshJones1
Deactivated User
I am trying to use the new Pop-Ups feature to allow for a image to be displayed when I mouse over a shapefile outline.  I currently have a raster dataset stored in the shapefile attribute table and I am trying to figure out how to have the image pop up when it is clicked on or moused over.


Is this possible?  Does anybody have any other ideas on how to best use the new Pop-Up widget to reach this goal?  I have about thirteen separate regions within the shapefile and I have a different image subset associated with each of the regions, which is why I loaded all of the rasters independently.
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Josh,

   Here is a sample app.

<?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">
 <fx:Script>
  <![CDATA[
   import com.esri.ags.webmap.PopUpRenderer;
   import com.esri.ags.webmap.supportClasses.PopUpFieldFormat;
   import com.esri.ags.webmap.supportClasses.PopUpFieldInfo;
   import com.esri.ags.webmap.supportClasses.PopUpInfo;
   import com.esri.ags.webmap.supportClasses.PopUpMediaInfo;
   import com.esri.ags.geometry.Extent;
   import com.esri.ags.geometry.MapPoint;

   private function initCLayer():void
   {
    var popUpInfo:PopUpInfo = new PopUpInfo();
    var pFieldInfos:Array = new Array();
    
    var pFieldInfo:PopUpFieldInfo;
    pFieldInfo = new PopUpFieldInfo();
    pFieldInfo.fieldName = "DESCRIPTION";
    pFieldInfo.format = new PopUpFieldFormat();
    pFieldInfos.push(pFieldInfo);
    
    pFieldInfo = new PopUpFieldInfo();
    pFieldInfo.fieldName = "ONLINE";
    pFieldInfo.format = new PopUpFieldFormat();
    pFieldInfos.push(pFieldInfo);
    
    pFieldInfo = new PopUpFieldInfo();
    pFieldInfo.fieldName = "LAST_UPDATED";
    pFieldInfo.format = new PopUpFieldFormat();
    pFieldInfos.push(pFieldInfo);
    
    pFieldInfo = new PopUpFieldInfo();
    pFieldInfo.fieldName = "URL";
    pFieldInfo.format = new PopUpFieldFormat();
    pFieldInfos.push(pFieldInfo);
    
    popUpInfo.popUpFieldInfos = pFieldInfos;
    
    var pMediaInfos:Array = new Array();
    var pMediaInfo:PopUpMediaInfo = new PopUpMediaInfo();
    pMediaInfo.caption = "Latest Image {LAST_UPDATED} online: {ONLINE}";
    pMediaInfo.type = "image";
    pMediaInfo.imageLinkURL = "{URL}";
    pMediaInfo.imageSourceURL = "{URL}";
    pMediaInfos.push(pMediaInfo);
    popUpInfo.popUpMediaInfos = pMediaInfos;
    popUpInfo.title = "{DESCRIPTION}"
    var popUpRenderer:ClassFactory = new ClassFactory(PopUpRenderer);
    popUpRenderer.properties = {popUpInfo:popUpInfo};

    cLayer.infoWindowRenderer = popUpRenderer;
   }
  ]]>
 </fx:Script>
 <esri:Map id="myMap" level="4" load="myMap.centerAt(new MapPoint(-11713000, 4822000))">
  <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
  <esri:FeatureLayer id="cLayer" outFields="[URL,DESCRIPTION,LAST_UPDATED,ONLINE]" load="initCLayer()"
   url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_PublicSafety_Louisville/MapServer/2"/>
 </esri:Map>
</s:Application>
0 Kudos
JoshJones1
Deactivated User
Thanks Robert for the very quick and informative response.

I am very new at using ArcServer.  I am an intermediate GIS student with no experience at coding.  Would I have to implement that code in Flash Builder, or how exactly would I go about implementing that app code?  Up to this point all I have done is edit the existing widgets that are present in the flexviewer folder.



-Josh
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Josh,

   Oh, OK you are posting to the wrong forum then... See this thread

http://forums.arcgis.com/threads/28487-PopUps
0 Kudos