Mike, OK Here is a working version of your widget:<?xml version="1.0" encoding="utf-8"?>
<!--
///////////////////////////////////////////////////////////////////////////
// Written by Micheal W. Smith
//
// Aug 15, 2013
// This Widget is meant to read the URL, parse for a specific parameter (facility or premise) and a unique id
// The result is zoomed, centered and marked with a point.
//
///////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:Search="widgets.Search.*"
xmlns:viewer="com.esri.viewer.*"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:components="com.esri.viewer.components.*"
creationComplete="basewidget_widgetConfigLoaded()">
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import com.esri.ags.Graphic;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.GraphicsLayer;
import com.esri.viewer.ViewerContainer;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;
[Bindable]
public var UniqueID:String = "000000";
private var zoomScale:Number = 10000;
private var graphicsLayer:GraphicsLayer;
private function basewidget_widgetConfigLoaded():void
{
var layer:String ="";
if(ViewerContainer.urlConfigParams.premise != null){
layer="premise";
UniqueID = ViewerContainer.urlConfigParams.premise;
queryPremise.execute(queryPoint, new AsyncResponder(onResult, onFault));
}
if(ViewerContainer.urlConfigParams.facility != null){
layer="facility";
UniqueID = ViewerContainer.urlConfigParams.ViewerContainer.urlConfigParams.facility;
queryFacility.execute(queryPoint, new AsyncResponder(onResult, onFault));
}
function onResult(featureSet:FeatureSet, token:Object = null):void
{
if (featureSet.features.length == 0)
{
Alert.show("No mapable items found. Please try again.");
}
else
{
map.scale = zoomScale;
map.centerAt(featureSet.features[0].geometry as MapPoint);
var myGraphicMarker:Graphic = featureSet.features[0] as Graphic;
myGraphicMarker.symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 22, 0x009933);
graphicsLayer = new GraphicsLayer();
graphicsLayer.add(myGraphicMarker);
//adding the graphics layer to the map
map.addLayer(graphicsLayer);
}
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Symbol for Query Result as Point -->
<esri:SimpleMarkerSymbol id="sfs" alpha="36" color="Black"/>
<!-- Layer with Premises -->
<esri:QueryTask id="queryPremise" url="http://atlantis:6080/arcgis/rest/services/SearchTest/MapServer/0"/>
<esri:QueryTask id="queryFacility" url="http://atlantis:6080/arcgis/rest/services/SearchTest/MapServer/3"/>
<esri:Query id="queryPoint"
outSpatialReference="{map.spatialReference}"
returnGeometry="true"
text="{UniqueID}">
</esri:Query>
</fx:Declarations>
</viewer:BaseWidget>