<?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 Turn off sublayer A, sublayer B will turn off too in ArcGIS Viewer for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588305#M16795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there any simple way to uncheck sublayer A on TOC&amp;nbsp; then sublayer B will automatically turn off based on sublayer A?&amp;nbsp; On the other hand, if sublayer A is turn on then sublayer b will turn on too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Sep 2013 14:15:50 GMT</pubDate>
    <dc:creator>MayJeff</dc:creator>
    <dc:date>2013-09-09T14:15:50Z</dc:date>
    <item>
      <title>Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588305#M16795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there any simple way to uncheck sublayer A on TOC&amp;nbsp; then sublayer B will automatically turn off based on sublayer A?&amp;nbsp; On the other hand, if sublayer A is turn on then sublayer b will turn on too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 14:15:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588305#M16795</guid>
      <dc:creator>MayJeff</dc:creator>
      <dc:date>2013-09-09T14:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588306#M16796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This thread should help you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/89934-LayerList-Widget-Turn-on-Sublayers?p=319435"&gt;http://forums.arcgis.com/threads/89934-LayerList-Widget-Turn-on-Sublayers?p=319435&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 14:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588306#M16796</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2013-09-09T14:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588307#M16797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I saw the thread you answered here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/89934-LayerList-Widget-Turn-on-Sublayers?p=319435&amp;amp;viewfull=1#post319435"&gt;http://forums.arcgis.com/threads/89934-LayerList-Widget-Turn-on-Sublayers?p=319435&amp;amp;viewfull=1#post319435&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you show me how do you setup a listener on the Show of a layer you mentioned on the thread?&amp;nbsp; I can't figure out of this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 16:02:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588307#M16797</guid>
      <dc:creator>MayJeff</dc:creator>
      <dc:date>2013-09-09T16:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588308#M16798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The code was in the last post of the thread.&amp;nbsp; Not sure what else you need.&amp;nbsp; Look at the top of the thread for the code to make a layer visible - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your case I would probably setup a Show listener on layer B and then on that event make layer A visible.&amp;nbsp; And then setup a Show listener on layer B to turn on A.&amp;nbsp; Then add 2 listeners on the Hide event (I think it is called hide) to do that same things but turn off the visible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is layerlist&lt;J&gt;.addEventListener(FlexEvent.SHOW, mapLayerAddHandler2, false, 0, true); &lt;/J&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where mapLayerAddHandler2 is your function.&amp;nbsp; j would be the index of the A layer and B layer.&amp;nbsp; If you do not know the index you can look it up.&amp;nbsp; I have seen the code to lookup the layer index somewhere on the forum but I can not find it now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your layers do not become visible try to add this to refresh the TOC&amp;nbsp; toc.validateNow()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 16:25:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588308#M16798</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2013-09-09T16:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588309#M16799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for replying my thread.&amp;nbsp; Do you add both inside TocItemRebderer.as? or add the event listener inside TocMapLayerItem.as?&amp;nbsp; My problem is not sure where to add the function too.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 18:14:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588309#M16799</guid>
      <dc:creator>MayJeff</dc:creator>
      <dc:date>2013-09-09T18:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588310#M16800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I set mine in the Init of a custom widget.&amp;nbsp; For you I think you could put it in either files Init section and it should get run when Flex is loading the map.&amp;nbsp; Anywhere it will get run on startup should work.&amp;nbsp; Sorry I am not that experienced at flex yet.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 19:57:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588310#M16800</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2013-09-09T19:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588311#M16801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you information.&amp;nbsp; Actually I would like to be able to control layer visibility on TOC checkbox by clicking it to turn on/off sublayer.&amp;nbsp; If sublayer A is on then sublayer B will on.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 13:52:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588311#M16801</guid>
      <dc:creator>MayJeff</dc:creator>
      <dc:date>2013-09-10T13:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588312#M16802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is what the show event does.&amp;nbsp; You are just setting up the event listener in the init.&amp;nbsp; Then the procedure you create is called when the event happens (in this case when the box is checked).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 14:45:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588312#M16802</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2013-09-10T14:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588313#M16803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for replying my thread again,&amp;nbsp; Really appreciate your time.&amp;nbsp; I think I got some ideas but still unclear on some part.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Even though there are in separate group layer? I added the code your mention to my init function on TOCWidget.mxml&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you change to specific layer id for sublayer A (i.e. layerlist[10])?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Code 1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//new add -----------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var layerlist:ArrayCollection = map.layers as ArrayCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var j:int = 0; j &amp;lt; layerlist.length; j++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (toc.basemapLayers.getItemIndex(layerlist&lt;J&gt;.id) == -1)&lt;/J&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerlist&lt;J&gt;.addEventListener(FlexEvent.SHOW, mapLayerAddHandler2, false, 0, true);&lt;/J&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //end new add ----------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code 2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; private function mapLayerAddHandler2():void&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Try to turn off sublayer B if sublayer A is being turn off&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 16:48:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588313#M16803</guid>
      <dc:creator>MayJeff</dc:creator>
      <dc:date>2013-09-10T16:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off sublayer A, sublayer B will turn off too</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588314#M16804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the code 1 section that codes sets up a listener for ALL layers - you just want A and B so adjust accordingly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On Code 2 section I do not know how.&amp;nbsp; There is code in TOCMapLayerItem.as of setVisible(layer.visible, true);&amp;nbsp; so that may work if you are in that file.&amp;nbsp; I think there is a .visible property in the layer somewhere.&amp;nbsp; Search the forums I am sure it is on there.&amp;nbsp; Or just look through all the properties of the layer object and find it and try it.&amp;nbsp; Flex can be a lot of trial and error when you start.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Like I said I am new so that is all the help I got.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 20:19:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/turn-off-sublayer-a-sublayer-b-will-turn-off-too/m-p/588314#M16804</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2013-09-10T20:19:34Z</dc:date>
    </item>
  </channel>
</rss>

