<?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: Event - Item selected (checkbox) in Table Of Content in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/event-item-selected-checkbox-in-table-of-content/m-p/5814#M138</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is some code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Add this attribute to the toc element
itemRollOver="setLastTreeItem(event)"

//Add these import
import mx.events.ListEvent;
import com.esri.maplib.tocClasses.TocItem;

//Add this var
public var lastTreeItem:ListEvent;

//Add this new function
public function setLastTreeItem(event:ListEvent):void
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastTreeItem = event;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

//Then you can add something like this to your function to get a TocItem
var item:TocItem = TocItem(lastTreeItem.itemRenderer.data);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from the item you can get the label or check for isGroupLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:14:15 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2021-12-10T20:14:15Z</dc:date>
    <item>
      <title>Event - Item selected (checkbox) in Table Of Content</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/event-item-selected-checkbox-in-table-of-content/m-p/5813#M137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working on ArcServer 9.3, Flex 4, Esri API for Flex 1.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I try to get an event (Alert.show) when a user selects one of the group-layer in the Table Of Content. The GroupLayer is in a MapService which contains other GroupLayers that don't requiere any Alert.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;E.g. : In the Table Of Content, when the user selects the "NewRoadProject" grouplayer checkbox &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;(the group layer "NewRoadProject" in a mapservice containing other grouplayers)&lt;/SPAN&gt;&lt;SPAN&gt; then the AlertShow display : "This data is blablabla". &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the TOC found in the &lt;/SPAN&gt;&lt;A href="http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=15874"&gt;Ressource Centers code gallery&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Among the methods available in the tocClasses (TocItem - TocItemRender - TocLayerInfoItem - TocMapLayerItem) I've got : "Item.label" - "item.isGroupLayer" and some "checkBox - checkBox Selected" functionalities.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I need to create an Event Listener in the TOC and a function which will retreive the name of the selected Item. Then if the Item.label name is "NewRoadProject" the alert show is displayed. I tried to play arround with these methods but unsuccessfully. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First Difficulty, I don't manage to get the "Item-methods" in my function. Again, my level is beginner and I would be grateful if someone can help me and get me on the rails.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Oct 2010 21:29:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/event-item-selected-checkbox-in-table-of-content/m-p/5813#M137</guid>
      <dc:creator>SchoppMatthieu</dc:creator>
      <dc:date>2010-10-18T21:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Event - Item selected (checkbox) in Table Of Content</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/event-item-selected-checkbox-in-table-of-content/m-p/5814#M138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is some code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Add this attribute to the toc element
itemRollOver="setLastTreeItem(event)"

//Add these import
import mx.events.ListEvent;
import com.esri.maplib.tocClasses.TocItem;

//Add this var
public var lastTreeItem:ListEvent;

//Add this new function
public function setLastTreeItem(event:ListEvent):void
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastTreeItem = event;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

//Then you can add something like this to your function to get a TocItem
var item:TocItem = TocItem(lastTreeItem.itemRenderer.data);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from the item you can get the label or check for isGroupLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/event-item-selected-checkbox-in-table-of-content/m-p/5814#M138</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-10T20:14:15Z</dc:date>
    </item>
  </channel>
</rss>

