I'm working on upgrading our App to Flex 4.5 and ArcGIS Flex API 2.3.1. Everything went smoothly thanks to some tips I read in another thread but there is still one thing I can't figure out.We have code in many of our widgets that will close the current running widget if another widget is opened.This is not even really the behavior I wanted in the first place. I would rather have the reverse where the openDetect function will close the widget that it is trying to open but I haven't been able to figure that one out.So the actual error is that this.close(); does not exist. I tried tacking an id onto BaseWidget like id="myBaseWidget" but myBaseWidget.close() does not exists either.I would very much appreciate if anyone could tell me what's up with the close function and If anyone knows how I could block the widget trying to be opened in openDetect that would be even better.
private function openDetect(event:AppEvent):void {
var id:Number = event.data as Number;
var idx:Object = configData.widgetIndex[id];
var wgt:Object = configData.widgetContainers[idx.container].widgets[idx.widget];
var wid:String = wgt.url;
var blocked:ArrayCollection = new ArrayCollection([
"widgets/EditSWEATIR/EditSWEATIRWidget.swf"
]);
if(blocked.contains(wid)){
this.close();
}
}
private function widgetOpenedHandler(event:Event):void
{
ViewerContainer.addEventListener(AppEvent.WIDGET_RUN, openDetect);
}