<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Attribute Inspector (edit)"> <fx:Script> <![CDATA[ import com.esri.ags.Graphic; import com.esri.ags.SpatialReference; import com.esri.ags.events.FeatureLayerEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.Geometry; import com.esri.ags.geometry.MapPoint; import com.esri.ags.geometry.Polygon; import com.esri.ags.symbols.SimpleFillSymbol; import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; private var mapClickPoint:MapPoint; protected function map_mapClickHandler(event:MapMouseEvent):void { // convert click to an extents var vPt:MapPoint = event.mapPoint; mapClickPoint = event.mapPoint; var vX:Number = vPt.x; var vY:Number = vPt.y; var vExtent:Extent = new Extent(vX - 100, vY - 100,vX + 100, vY + 100) var thisSelectionQuery:Query = new Query(); thisSelectionQuery.geometry = vExtent; myFeatureLayer.selectFeatures(thisSelectionQuery, FeatureLayer.SELECTION_NEW); } protected function attrInsp_faultHandler(event:FaultEvent):void { Alert.show(event.fault.message, "Fault"); } protected function myFeatureLayer_selectionCompleteHandler(event:FeatureLayerEvent):void { // only show infoWindow if a feature was found if (event.featureLayer.numGraphics > 0){ myMap.infoWindow.label = "Sign " + event.featureLayer.selectedFeatures[0].attributes.OBJECTID; myMap.infoWindow.show(mapClickPoint); }else{ Alert.show("Sorry found nothing here..."); } } ]]> </fx:Script> <fx:Declarations> <esri:Query id="queryMapClick"/> </fx:Declarations> <fx:Style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace esri "http://www.esri.com/2008/ags"; esri|InfoWindow { background-color: #BDB76B; /* dark khaki */ border-color: #000000; border-thickness: 3; lower-left-radius: 20; lower-right-radius: 20; upper-left-radius: 20; upper-right-radius: 0; padding-bottom: 7; padding-left: 7; padding-right: 7; padding-top: 4; } esri|InfoWindowLabel { color: #FFFFFF; font-size: 15; padding-left: 120; } s|BorderContainer { background-color: #F0E68C; /* light khaki */ corner-radius: 15; content-background-color: #BDB76B; padding-bottom: 5; } </fx:Style> <s:layout> <s:VerticalLayout/> </s:layout> <esri:Map id="myMap" load="attrInsp.featureLayers = [myFeatureLayer]" mapClick="map_mapClickHandler(event)" openHandCursorVisible="false"> <!-- Extent for Woukesha Signs --> <esri:extent> <esri:Extent xmin="2468000" ymin="371000" xmax="2475000" ymax="376000"> <esri:SpatialReference wkid="32054"/> </esri:Extent> </esri:extent> <esri:ArcGISDynamicMapServiceLayer url="https://maps.ags.ruekert-mielke.com/AGS/rest/services/WaukeshaCity/WaukeshaSignsSampleSigns/MapServer"/> <esri:ArcGISDynamicMapServiceLayer url="https://maps.ags.ruekert-mielke.com/AGS/rest/services/WaukeshaCity/WaukeshaSignsSampleApp2/MapServer"/> <esri:FeatureLayer id="myFeatureLayer" mode="selection" outFields="[HouseNumber,StreetName]" selectionColor="0x000000" selectionComplete="myFeatureLayer_selectionCompleteHandler(event)" url="https://maps.ags.ruekert-mielke.com/AGS/rest/services/WaukeshaCity/WaukeshaSignsSampleSigns/MapServer/0"/> <esri:GraphicsLayer id="myGraphicsLayer"> <esri:Graphic> <esri:geometry> <esri:MapPoint x="2471315" y="374682" spatialReference="{new SpatialReference(32054)}"/> </esri:geometry> </esri:Graphic> </esri:GraphicsLayer> <esri:infoWindowContent> <s:BorderContainer> <esri:AttributeInspector id="attrInsp"/> </s:BorderContainer> </esri:infoWindowContent> </esri:Map> <s:Label text="The feature layer has {myFeatureLayer.selectedFeatures.length} selected feature(s)."/> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Attribute Inspector (edit)"> <fx:Script> <![CDATA[ import com.esri.ags.Graphic; import com.esri.ags.SpatialReference; import com.esri.ags.events.FeatureLayerEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.Geometry; import com.esri.ags.geometry.MapPoint; import com.esri.ags.geometry.Polygon; import com.esri.ags.symbols.SimpleFillSymbol; import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; //public var queryMapClick1:MapPoint; protected function map_mapClickHandler(event:MapMouseEvent):void { // convert click to an extents var vPt:MapPoint = event.mapPoint; queryMapClick = event.mapPoint; var vX:Number = vPt.x; var vY:Number = vPt.y; var vExtent:Extent = new Extent(vX - 100, vY - 100,vX + 100, vY + 100) var thisSelectionQuery:Query = new Query(); thisSelectionQuery.geometry = vExtent; myFeatureLayer.selectFeatures(thisSelectionQuery, FeatureLayer.SELECTION_NEW); } protected function attrInsp_faultHandler(event:FaultEvent):void { Alert.show(event.fault.message, "Fault"); } protected function myFeatureLayer_selectionCompleteHandler(event:FeatureLayerEvent):void { // only show infoWindow if a feature was found if (event.featureLayer.numGraphics > 0) { myMap.infoWindow.label = "Sign " + event.featureLayer.selectedFeatures[0].attributes.OBJECTID; //I am not sure what I should do with this myMap.infoWindow.show(queryMapClick.geometry as MapPoint); } else { Alert.show("Sorry found nothing here..."); } } ]]> </fx:Script> <fx:Declarations> <esri:Query id="queryMapClick"/> </fx:Declarations> <fx:Style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace esri "http://www.esri.com/2008/ags"; esri|InfoWindow { background-color: #BDB76B; /* dark khaki */ border-color: #000000; border-thickness: 3; lower-left-radius: 20; lower-right-radius: 20; upper-left-radius: 20; upper-right-radius: 0; padding-bottom: 7; padding-left: 7; padding-right: 7; padding-top: 4; } esri|InfoWindowLabel { color: #FFFFFF; font-size: 15; padding-left: 120; } s|BorderContainer { background-color: #F0E68C; /* light khaki */ corner-radius: 15; content-background-color: #BDB76B; padding-bottom: 5; } </fx:Style> <s:layout> <s:VerticalLayout/> </s:layout> <esri:Map id="myMap" load="attrInsp.featureLayers = [myFeatureLayer]" mapClick="map_mapClickHandler(event)" openHandCursorVisible="false"> <!-- Extent for Woukesha Signs --> <esri:extent> <esri:Extent xmin="2468000" ymin="371000" xmax="2475000" ymax="376000"> <esri:SpatialReference wkid="32054"/> </esri:Extent> </esri:extent> <esri:ArcGISDynamicMapServiceLayer url="https://maps.ags.ruekert-mielke.com/AGS/rest/services/WaukeshaCity/WaukeshaSignsSampleSigns/MapServer"/> <esri:ArcGISDynamicMapServiceLayer url="https://maps.ags.ruekert-mielke.com/AGS/rest/services/WaukeshaCity/WaukeshaSignsSampleApp2/MapServer"/> <esri:FeatureLayer id="myFeatureLayer" mode="selection" outFields="[HouseNumber,StreetName]" selectionColor="0x000000" selectionComplete="myFeatureLayer_selectionCompleteHandler(event)" url="https://maps.ags.ruekert-mielke.com/AGS/rest/services/WaukeshaCity/WaukeshaSignsSampleSigns/MapServer/0"/> <esri:GraphicsLayer id="myGraphicsLayer"> <esri:Graphic> <esri:geometry> <esri:MapPoint x="2471315" y="374682" spatialReference="{new SpatialReference(32054)}"/> </esri:geometry> </esri:Graphic> </esri:GraphicsLayer> <esri:infoWindowContent> <s:BorderContainer> <esri:AttributeInspector id="attrInsp"/> </s:BorderContainer> </esri:infoWindowContent> </esri:Map> <s:Label text="The feature layer has {myFeatureLayer.selectedFeatures.length} selected feature(s)."/> </s:Application>
<fx:Declarations> <esri:Query id="queryMapClick"/> </fx:Declarations>
1067: Implicit coercion of a value of type com.esri.ags.geometry:MapPoint to an unrelated type com.esri.ags.tasks.supportClasses:Query
<fx:Script> <![CDATA[ import com.esri.ags.Graphic; import com.esri.ags.SpatialReference; import com.esri.ags.events.FeatureLayerEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.Geometry; import com.esri.ags.geometry.MapPoint; import com.esri.ags.geometry.Polygon; import com.esri.ags.layers.FeatureLayer; import com.esri.ags.symbols.SimpleFillSymbol; import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; protected function map_mapClickHandler(event:MapMouseEvent):void { // convert click to an extents var vPt:MapPoint = event.mapPoint; queryMapClick = event.mapPoint; var vX:Number = vPt.x; var vY:Number = vPt.y; var vExtent:Extent = new Extent(vX - 100, vY - 100,vX + 100, vY + 100) var thisSelectionQuery:Query = new Query(); thisSelectionQuery.geometry = vExtent; var myFeatureLayer:FeatureLayer = new FeatureLayer; } protected function attrInsp_faultHandler(event:FaultEvent):void { Alert.show(event.fault.message, "Fault"); } protected function myFeatureLayer_selectionCompleteHandler(event:FeatureLayerEvent):void { // only show infoWindow if a feature was found if (event.featureLayer.numGraphics > 0) { myMap.infoWindow.label = "Sign " + event.featureLayer.selectedFeatures[0].attributes.OBJECTID; //I am not sure what I should do with this myMap.infoWindow.show(queryMapClick.geometry as MapPoint); } else { Alert.show("Sorry found nothing here..."); } } ]]> </fx:Script>
Cannot access a property or method of a null object reference.
try { var myObject:Object = new Object(); // myObject is not null myObject.myParameter = "Hello world!"; var message:String = myObject.myParameter; trace(message); } catch (error:Error) { trace(error.message.toString()); }
try { var myObject:Object = new Object(); // myObject is null var message:String = myObject.myParameter; trace(message); } catch (error:Error) { trace(error.message.toString()); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.