<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Highlight a feature when using popups in ArcGIS Viewer for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/highlight-a-feature-when-using-popups/m-p/737955#M22171</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my flex viewer when a user clicks a feature in an operational layer that has a popup configured, I would like that feature to somehow become highlighted as long as the popup is visible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ideas on how to make it happen, or on where in the source code I should start trying? Will it be possible changing only the Viewer source code and not the API?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Nov 2011 07:11:38 GMT</pubDate>
    <dc:creator>MattiasEkström</dc:creator>
    <dc:date>2011-11-22T07:11:38Z</dc:date>
    <item>
      <title>Highlight a feature when using popups</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/highlight-a-feature-when-using-popups/m-p/737955#M22171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my flex viewer when a user clicks a feature in an operational layer that has a popup configured, I would like that feature to somehow become highlighted as long as the popup is visible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ideas on how to make it happen, or on where in the source code I should start trying? Will it be possible changing only the Viewer source code and not the API?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2011 07:11:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/highlight-a-feature-when-using-popups/m-p/737955#M22171</guid>
      <dc:creator>MattiasEkström</dc:creator>
      <dc:date>2011-11-22T07:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight a feature when using popups</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/highlight-a-feature-when-using-popups/m-p/737956#M22172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've been thinking and trying out some solutions for this, and ended up customizing the PopUpRendererSkin. It works but I'm not really satisfied with the solution, what I would like is to use some kind of AppEvent for showing PopUp and closing/hidning PopUp. I've been looking through the documentation but I can't find anything like that, I've tried using SHOW_INFOWINDOW and some other events without success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've not tried to create my own custom AppEvent, because I wouldn't know how to dispatch the events when PopUp shows or hides, if I knew that I would probably not even have to create any AppEvents.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone knows a way to listen to the events of showing and closing/hiding a PopUp? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone is interested in the solution I have so far, I got the PopUpRendererSkin.mxml from downloading the API and copied it to src/com/esri/viewer/skins/ and to the default.css I added:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;esri|PopUpRenderer
{
 skin-class: ClassReference("com.esri.viewer.skins.PopUpRendererSkin");
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All the code I put in PopUpRendererSkin.mxml, at the end of the commitProperties function add:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;// My addition for highlighting popup features...
&amp;nbsp;&amp;nbsp;&amp;nbsp; var glExists:Boolean = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var glID:int;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //Go through layerIds in map to check if the highlightGraphics graphiclayer exists and if so get its id.
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i:int = 0; i &amp;lt; map.layerIds.length; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (map.layerIds&lt;I&gt;== "highlightGraphics")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glID = i;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glExists = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; //If highlightGraphics graphicslayer doesn't exist, create it and add it to the map.
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!glExists){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var gl:GraphicsLayer = new GraphicsLayer();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gl.id = "highlightGraphics";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gl.visible = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(gl,200);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the id of the graphicslayer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var j:int = 0; j &amp;lt; map.layerIds.length; j++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (map.layerIds&lt;J&gt;== "highlightGraphics")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glID = j;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glExists = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set the highlight graphic symbol
&amp;nbsp;&amp;nbsp;&amp;nbsp; var hlGraphic:Graphic = new Graphic(graphic.geometry);
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch(hlGraphic.geometry.type)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Geometry.MAPPOINT:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hlGraphic.symbol = new SimpleMarkerSymbol("circle",22,0x000000,0,0,0,0,new SimpleLineSymbol("solid",0xFF0000,0.5,2));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case Geometry.POLYLINE:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hlGraphic.symbol = new SimpleLineSymbol("solid",0xFF0000,0.3,8);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hlGraphic.symbol = new SimpleFillSymbol("solid",0x000000,0,new SimpleLineSymbol("solid",0xFF0000,0.4,3));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; //set a glow filter to the highlight graphic
&amp;nbsp;&amp;nbsp;&amp;nbsp; var gf:spark.filters.GlowFilter = new spark.filters.GlowFilter();
&amp;nbsp;&amp;nbsp;&amp;nbsp; gf.color = 0xFF0000;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gf.alpha = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gf.strength = 2;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gf.blurX = 8;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gf.blurY = 8;
&amp;nbsp;&amp;nbsp;&amp;nbsp; hlGraphic.filters = [gf];
&amp;nbsp;&amp;nbsp;&amp;nbsp; //Clear the highlightGraphics graphiclayer and add the new highight graphic
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.layers[glID].clear();
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.layers[glID].add(hlGraphic);
&amp;nbsp;&amp;nbsp;&amp;nbsp; //add eventhandlers to "unhighlight" features
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.closeButton.addEventListener(MouseEvent.CLICK, onInfoWindowClosed);
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addEventListener(MapMouseEvent.MAP_CLICK, onMapClick)
// --- end addition ---------------&lt;/J&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And then add a these two functions somewhere:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//My handler for clicking closebutton on a popup/infowindow
&amp;nbsp;&amp;nbsp; private function onInfoWindowClosed(event:MouseEvent):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(hostComponent.map){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i:int = 0; i &amp;lt; hostComponent.map.layerIds.length; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (hostComponent.map.layerIds&lt;I&gt;== "highlightGraphics")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hostComponent.map.layers&lt;I&gt;.clear();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hostComponent.map.infoWindow.closeButton.removeEventListener(MouseEvent.CLICK, onInfoWindowClosed);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }
//My handler for a mapclick, mapclicking outside a feature with popup configuration will hide popup/infowindow and clear the highlight graphics.
&amp;nbsp;&amp;nbsp; private function onMapClick(event:MapMouseEvent):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i:int = 0; i &amp;lt; event.map.layerIds.length; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (event.map.layerIds&lt;I&gt;== "highlightGraphics")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; event.map.layers&lt;I&gt;.clear();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; event.map.infoWindow.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; event.map.removeEventListener(MapMouseEvent.MAP_CLICK, onMapClick);
&amp;nbsp;&amp;nbsp; }&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:26:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/highlight-a-feature-when-using-popups/m-p/737956#M22172</guid>
      <dc:creator>MattiasEkström</dc:creator>
      <dc:date>2021-12-12T07:26:01Z</dc:date>
    </item>
  </channel>
</rss>

