<?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: LiveMapsWidget doesn't follow changes in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273576#M6421</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks - that was really helpful Robert and Gerardo!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Feb 2011 07:13:04 GMT</pubDate>
    <dc:creator>IsharaKotiah</dc:creator>
    <dc:date>2011-02-17T07:13:04Z</dc:date>
    <item>
      <title>LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273567#M6412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In Flexviewer 1.3 the&amp;nbsp; LiveMapsWidget doesn't follow the layer visibility changes if i turn off one or more layers&amp;nbsp; by actionscript like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public function hideLayer(name:String,service:ArcGISDynamicMapServiceLayer):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; var Arr:Array = service.layerInfos;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for each (var layerInfo:LayerInfo in Arr){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var idIndex:int =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; service.visibleLayers.getItemIndex(layerInfo.id);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(layerInfo.name == name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; service.visibleLayers.removeItemAt(idIndex);
&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; 

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tryed to figure out where and how can i refresh the LiveMapsWidget but i realized the bigest problem is that if i modify the layers visibility by code before and then i start the LiveMapsWidget, it shows wrong layer visibility. It seems to read the visibility settings from another property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;please help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GeorgeG&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jan 2011 08:15:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273567#M6412</guid>
      <dc:creator>GyorgyGyorfi</dc:creator>
      <dc:date>2011-01-12T08:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273568#M6413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's right because if you want to hide a layer you must set the visibile = false to the item in the livemapwidget. you must use the TOC object and navigate the list of layer in the service. I've made so and it works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jan 2011 13:15:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273568#M6413</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2011-01-12T13:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273569#M6414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It's right because if you want to hide a layer you must set the visibile = false to the item in the livemapwidget. you must use the TOC object and navigate the list of layer in the service. I've made so and it works.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't clearly understand what should i do. Could you tell me&amp;nbsp; where did you modify the code?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 10:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273569#M6414</guid>
      <dc:creator>GyorgyGyorfi</dc:creator>
      <dc:date>2011-01-13T10:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273570#M6415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In your LiveMapsWidget you must use the var levelsTOC:Object = toc.dataProvider and for each TocMapLayerItem navigate each TocLAyerInfoItem and set visible true or false and automatically the TOC content is updatet. It's a little bit complicated but if you manage your layer the widget you must to share the toc.dataprovider between others widget or the main app. I've spent a lot of time over this thing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 11:48:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273570#M6415</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2011-01-13T11:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273571#M6416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;George &amp;amp; Giosia,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; I have code that will change one specific layers visibility at a time by providing the layers name (can be a sublayer also) and update the tocs checkbox all through code. It requires code additions to TocItem.as and AppEvent.as.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is dispatched with the following line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;SiteContainer.dispatchEvent(new AppEvent(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, false, false, "Major Roads"));&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;let me know if either of you are interested.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 15:49:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273571#M6416</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2011-01-13T15:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273572#M6417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's a great idea, can you share your code? Pherhaps I use it in future.&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>Fri, 14 Jan 2011 05:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273572#M6417</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2011-01-14T05:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273573#M6418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;in the meantime i found this old thread&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=158&amp;amp;f=2421&amp;amp;t=300662#939976" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.esri.com/Thread.asp?c=158&amp;amp;f=2421&amp;amp;t=300662#939976&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and it's solved my problem, but i extended the code with this at the&amp;nbsp; LiveMapsWidget.mxml on creationComplete &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private function tuc():void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each(var layerID:Number in (map.layers[0] as ArcGISDynamicMapServiceLayer).visibleLayers)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SiteContainer.dispatchEvent(new AppEvent(AppEvent.LAYER_VISIBILITY_CHANGED, false, true, layerID));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now work's fine in any case,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Thanks Robert!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273573#M6418</guid>
      <dc:creator>GyorgyGyorfi</dc:creator>
      <dc:date>2021-12-11T13:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273574#M6419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add/Replace these lines in the TocItem.as&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public function TocItem( parentItem:TocItem = null )
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; _parent = parentItem;
&amp;nbsp;&amp;nbsp; SiteContainer.addEventListener(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, updateCB);
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; private function updateCB(event:AppEvent):void
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; if(this is TocLayerInfoItem)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var tli:TocLayerInfoItem = this as TocLayerInfoItem;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tli.layerInfo.name == event.data){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setVisible(_visible ? false : true, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add this to the AppEvent.as&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&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; * event added by me to listen for a layer being turn off or on in the map
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * event for when a layers visibility has changed programaticly
&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; public static const PROGRAMATIC_LAYER_VISIBILITY_CHANGED:String = "programicLayerVisibilityChanged";&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then just call it like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp; private function test1(evt:Event):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; SiteContainer.dispatchEvent(new AppEvent(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, false, false, "Major Roads"));
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:21:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273574#M6419</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T13:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273575#M6420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For v2.1 of the Viewer, I did the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In TocItem.as, I checked layerInfo.id instead of layerInfo.name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public function TocItem(parentItem:TocItem = null)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; _parent = parentItem;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ViewerContainer.addEventListener(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, updateCheckBox);
}
private function updateCheckBox(event:AppEvent):void
{
 if(this is TocLayerInfoItem)
 {
&amp;nbsp; var tli:TocLayerInfoItem = this as TocLayerInfoItem;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; if(tli.layerInfo.id == event.data){
&amp;nbsp;&amp;nbsp; setVisible(_visible ? false : true, true);
&amp;nbsp; }
 }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my calling widget,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private function updateMapSwitcher(newVisibility:Array):void
{
 for each (var id:String in newVisibility)
 {
&amp;nbsp; // sends event to MapSwitcher widget to turn subLayer on
&amp;nbsp; ViewerContainer.dispatchEvent(new AppEvent(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, id));
 }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AppEvent.as code is the same as Robert's.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:21:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273575#M6420</guid>
      <dc:creator>GerardoGarza</dc:creator>
      <dc:date>2021-12-11T13:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273576#M6421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks - that was really helpful Robert and Gerardo!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Feb 2011 07:13:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273576#M6421</guid>
      <dc:creator>IsharaKotiah</dc:creator>
      <dc:date>2011-02-17T07:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: LiveMapsWidget doesn't follow changes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273577#M6422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks for info!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Feb 2011 07:15:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/livemapswidget-doesn-t-follow-changes/m-p/273577#M6422</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2011-02-17T07:15:25Z</dc:date>
    </item>
  </channel>
</rss>

