<?xml version="1.0" encoding="utf-8"?> <mx:VBox 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:supportClasses="com.esri.ags.components.supportClasses.*" initialize="initRenderer()"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ import com.esri.ags.Map; import mx.core.FlexGlobals; [Bindable] public var mainMap:Map; [Bindable] public var houseVis:Boolean; [Bindable] public var senateVis:Boolean; [Bindable] public var congressVis:Boolean; public function initRenderer(): void { mainMap = FlexGlobals.topLevelApplication.mainMap; houseVis = FlexGlobals.topLevelApplication.houseLayer.visible; senateVis = FlexGlobals.topLevelApplication.senateLayer.visible; congressVis = FlexGlobals.topLevelApplication.congressLayer.visible; trace ("within MyDistrictWindowRenderer, mainMap is " + mainMap.id + ", houseVis = " + houseVis + ", senateVis = " + senateVis + ", congressVis = " + congressVis); } ]]> </fx:Script> <supportClasses:InfoWindowLabel text="Missouri Districts" styleName="balloonTitle" /> <s:Label includeInLayout="{houseVis != ''? true:false}" visible="{houseVis != ''? true:false}" text="House: {data.HOUSE_DIST}" paddingTop="2"/> <s:Label includeInLayout="{senateVis != ''? true:false}" visible="{senateVis != ''? true:false}" text="Senate: {data.SEN_DIST}" paddingTop="2" /> <s:Label includeInLayout="{congressVis != ''? true:false}" visible="{congressVis != ''? true:false}" text="Congressional: {data.CONG_DIST}" paddingTop="2" /> </mx:VBox>private function onMouseUp(event:MouseEvent):void { var g:Graphic = Graphic(event.currentTarget); mainMap.infoWindow.hide(); mainMap.infoWindow.data = g.attributes; mainMap.infoWindow.closeButtonVisible=true; mainMap.infoWindow.content = myInfoWindowRenderer.newInstance(); mainMap.infoWindow.show( MapPoint(g.geometry.extent.center) ); mainMap.infoWindow.styleName = "myInfoWindow"; g.checkForMouseListeners = false; }Solved! Go to Solution.
public function layerQueryResults(qryFeatures:FeatureSet, token:Object = null): void {
/* populate graphic layer with features returned from the querytask. Using a graphiclayer instead of just calling
the service allows you to add tool tips etc that aren't available otherwise */
for each(var myGraphic : Graphic in qryFeatures.features) {
var houseVis:Boolean = houseLayer.visible;
var senateVis:Boolean = senateLayer.visible;
var congressVis:Boolean = congressLayer.visible;
/* myGraphic.addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
myGraphic.addEventListener(MouseEvent.ROLL_OUT, onMouseOut); */
myGraphic.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
myGraphic.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
//myGraphic.infoWindowRenderer = new ClassFactory(MyDistrictWindowRenderer);
myGraphicsLayer.add( myGraphic );
}
// myGraphicsLayer.graphicProvider = qryFeatures.features;
myGraphicsLayer.symbol = compositeSymbol;
mainMap.addLayer(myGraphicsLayer);
}