I am working with Robert's latest Identify widget for Flex Viewer 2.1 and I have modified the code to exclude showing data from layers and fields not defined in the IdentifyWidget.xml configuration file.
In the IdentifyWidget.mxml file, down in the function called processIdentifyResults there is a conditional if(IdentFields) which includes an else block. I commented out that entire else block. I believe that IdentFields holds all the fields that come from the configuration file, so blocking out anything not in IdentFields keeps all data not specified in the configuration file from being displayed.
You'll need to be using Flash Builder or some other solution to modify and recompile the code, of course.
This may not be an elegant solution, and Robert may cringe at it, but it works for me.
Marc
//process identify results private function processIdentifyResults(identifyResults:Array):void { if(!identifyArrayCollection) identifyArrayCollection = new ArrayCollection(); for each (var identifyResult:IdentifyResult in identifyResults) { var title:String = identifyResult.layerName; var obj:Object = identifyResult.feature.attributes; var content:String = ""; var fld:String; var value:String; var link:String = ""; var linkicon:String = ""; var identFields:String = ""; var identLinkPre:String = ""; var identLinkField:String = ""; var identLinkSuffix:String = ""; var identLinkIcon:String = ""; var identLinkIconPre:String = ""; var identLinkIconSuffix:String = ""; var identZoom:Number = 0; var identForceScale:Boolean = false; for(var i:int=0; i<configIdentFields.length; i++) { if (identifyResult.layerName == configIdentFields.label) { identLinkField = configIdentFields.linkfield; identFields = configIdentFields.fields; identLinkPre = configIdentFields.linkpre; identLinkSuffix = configIdentFields.linksuffix; identLinkIconPre = configIdentFields.linkiconpre; identLinkIcon = configIdentFields.linkicon; identLinkIconSuffix = configIdentFields.linkiconsuffix; identZoom = configIdentFields.zoomscale; identForceScale = configIdentFields.forcescale; } } if(identFields) { var fldArr:Array = identFields.split(","); for (var f:Number = 0; f < fldArr.length; f++) { try{ value = obj[fldArr].toString(); } catch (error: Error){ value = ""; } if (fldArr .toUpperCase() == identLinkField.toUpperCase()){ //concatenate link = identLinkPre + value + identLinkSuffix; } else if (fldArr .toUpperCase() == identLinkIcon.toUpperCase()){ //concatenate linkicon = identLinkIconPre + value + identLinkIconSuffix; } else { content += fldArr + ": " + value + "\n"; } } } /* else { for (fld in obj) { try{ value = obj[fld].toString(); } catch (error: Error){ value = ""; } if (fld.toUpperCase() == identLinkField.toUpperCase()) { link = value; } else { content += fld + ": " + value + "\n"; } } } */ var idResult:IdResult = new IdResult(); idResult.icon = widgetIcon; idResult.title = identifyResult.layerName; idResult.content = content; if(link!="") idResult.link = link; idResult.point = identifyPoint; idResult.geometry = identifyPoint; idResult.zoomScale = identZoom; idResult.zoom2msg = zoom2Msg; if(linkicon!="") idResult.linkicon = linkicon; idResult.forceScale = identForceScale; identifyArrayCollection.addItem(idResult); } clearMessage(); }