<?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 Re: FeatureLayer.clearSelection() fails in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194570#M4544</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the info. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tyler&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Dec 2011 13:05:08 GMT</pubDate>
    <dc:creator>TylerWaring</dc:creator>
    <dc:date>2011-12-21T13:05:08Z</dc:date>
    <item>
      <title>FeatureLayer.clearSelection() fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194566#M4540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings Everyone, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I keep getting a strange error when trying to clear a selection on a feature layer. My application lets the user select a feature and then gathers information from a related stand alone table and displays the results. The code works perfectly the first time. However, the second time around the code fails on FeatureLayer.clearSelection();. The error I get is detailed below. I have no idea how to resolve this. Any suggestions will be greatly appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards, Tyler Waring&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.display::DisplayObjectContainer/removeChild()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; at mx.core::UIComponent/&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.adobe.com/2006/flex/mx/internal::$removeChild" rel="nofollow" target="_blank"&gt;http://www.adobe.com/2006/flex/mx/internal::$removeChild&lt;/A&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.core::UIComponent/removeChild()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.layers::GraphicsLayer/collectionRemoveHandler()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.layers::GraphicsLayer/collectionChangeHandler()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEventFunction()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.collections::ListCollectionView/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.collections::ListCollectionView/removeItemsFromView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.collections::ListCollectionView/listChangeHandler()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEventFunction()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.collections::ArrayList/internalDispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.collections::ArrayList/removeItemAt()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.collections::ListCollectionView/removeItemAt()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.layers::GraphicsLayer/remove()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.layers::FeatureLayer/removeFeatureIIf()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.layers::FeatureLayer/clearSelectionInternal()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.layers::FeatureLayer/clearSelection()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at gov.durhamnc.durhammaps.subapps.FireFlow.presentation::FireFlowPM/findHydrant()&lt;S&gt;&lt;/S&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEventFunction()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.viewer::ViewerContainer$/dispatchEvent()&lt;S&gt;&lt;/S&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at gov.durhamnc.durhammaps.subapps.FireFlow.presentation::FireFlowPM/identifyEnd()&lt;S&gt;&lt;/S&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEventFunction()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags.tools::DrawTool/map_clickFirstHandler()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEventFunction()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at flash.events::EventDispatcher/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at mx.core::UIComponent/dispatchEvent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags::Map/dispatchMapMouseEvent()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.ags::Map/mouseUpHandler()&lt;C&gt;&lt;/C&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 17:13:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194566#M4540</guid>
      <dc:creator>TylerWaring</dc:creator>
      <dc:date>2011-12-20T17:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.clearSelection() fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194567#M4541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK... now this is strange. So I figured out the problem. For cartographic purposes, I have a graphicsLayer that I am adding the selected feature to. Strangely enough, adding a graphic to this layer is causing my error. If I take out the line that adds the graphic to the graphicsLayer, everything works as I would expect. However, I need to be able to display which feature is selected in the featureLayer and the design requirements of my map services do not allow me to impliment featureLayer.selectionColor effectively. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way around all this that I am overlooking. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Tyler Waring&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:28:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194567#M4541</guid>
      <dc:creator>TylerWaring</dc:creator>
      <dc:date>2011-12-20T18:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.clearSelection() fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194568#M4542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So after trying a number of different things I finally ended up with a simple solution. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;instead of: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for each (var g:Graphic in event.features)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; hydrantGraphicsLayer.add(g);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; objIds.push(g.attributes.OBJECTID_1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hydrantGraphic = new Graphic();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for each (var g:Graphic in event.features)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; hydrantGraphic.geometry = g.geometry;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; hydrantGraphicsLayer.add(hydrantGraphic);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; objIds.push(g.attributes.OBJECTID_1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what the difference is or why this was causing problems for me. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone knows why I'd be interested in knowing. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Tyler&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:43:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194568#M4542</guid>
      <dc:creator>TylerWaring</dc:creator>
      <dc:date>2011-12-20T18:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.clearSelection() fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194569#M4543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A Graphic can only exist in one layer at a time and Graphics that are in a FeatureLayer should not be added to other layers. By creating a new Graphic you're avoiding this issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 19:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194569#M4543</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2011-12-20T19:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.clearSelection() fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194570#M4544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the info. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tyler&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 13:05:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-clearselection-fails/m-p/194570#M4544</guid>
      <dc:creator>TylerWaring</dc:creator>
      <dc:date>2011-12-21T13:05:08Z</dc:date>
    </item>
  </channel>
</rss>

