Select to view content in your preferred language

Problem with Programatically Updating TOC visibility

1792
0
05-03-2011 09:22 AM
JamesFaron
Frequent Contributor
I am basically following steps from this forum topic:http://forums.arcgis.com/threads/20965-LiveMapsWidget-doesn-t-follow-changes

I changed TocItem.as (in both Robert's TOC Widget directory, and in src\components\tocClasses) as follows:
public class TocItem extends EventDispatcher
{
    public function TocItem(parentItem:TocItem = null)
    {
        _parent = parentItem;
  ViewerContainer.addEventListener(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, updateCheckBox);
    }
 private function updateCheckBox(event:AppEvent):void
 {
  if(this is TocLayerInfoItem)
  {
   var tli:TocLayerInfoItem = this as TocLayerInfoItem;
   if(tli.layerInfo.name == event.data){
    //setVisibleDirect(true);
    setVisible(_visible ? false : true, true)
   }
  }
 }


Entered Public static const in AppEvent.as:
public static const PROGRAMATIC_LAYER_VISIBILITY_CHANGED:String = "programicLayerVisibilityChanged";


Finally, called it in a widget as follows:
private function test1(evt:Event):void
   {
     ViewerContainer.dispatchEvent(new AppEvent(AppEvent.PROGRAMATIC_LAYER_VISIBILITY_CHANGED, "Students"));
   }


The end result is that the TOC layer is not updated from visible=false to visible=true. I must be missing a step, or perhaps something changed in a version update?

Thanks,
Jim Faron
Austin Independent School District
Tags (2)
0 Kudos
0 Replies