var identifyParams:IdentifyParameters = new IdentifyParameters(); identifyParams.returnGeometry = true; identifyParams.tolerance = 3; identifyParams.width = myMap.width; identifyParams.height = myMap.height; identifyParams.geometry = event.mapPoint; identifyParams.mapExtent = myMap.extent; identifyParams.spatialReference = myMap.spatialReference; identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL; identifyParams.layerIds = [0];
public class IdentifyHelper
{
private var _myIds:Array;
public function get myIds():Array
{
return this.myIds;
}
public function set myIds( value:Array ):void
{
this.myIds = value;
}
}
/* in theory all your identify parameters could go here, if you desire a different look and feel for each layer */
switch (myString) {
case "Rivers":
identifyhelper.myIds = [0];
break;
case "Lakes":
identifyhelper.myIds = [1];
break;
case "Plants":
identifyhelper.myIds = [2];
break;
}
identifyParams.layerIds = identifyhelper.myIds;
package com.esri.ags.script
{
public class IdentifyHelper
{
private var _myIds:Array;
public function get myIds():Array
{
return this.myIds;
}
public function set myIds( value:Array ):void
{
this.myIds = value;
}
}
}
private function onItemClick(event):void
{
switch (this.selectedItem.name)
{
case "Zoning":
IdentifyHelper.myIds = [4];
break;
case "LUP - Area Comm Plan":
IdentifyHelper.myIds = [5];
break;
case "LUP - General Plan":
IdentifyHelper.myIds = [6];
break;
}
}
protected function mapClickHandler(event:MapMouseEvent):void
{
clickGraphicsLayer.clear();
graphiclayer.clear();
var identifyParams:IdentifyParameters = new IdentifyParameters();
identifyParams.returnGeometry = true;
identifyParams.tolerance = 3;
identifyParams.width = map.width;
identifyParams.height = map.height;
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.spatialReference = map.spatialReference;
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.layerIds = IdentifyHelper.myIds;
var clickGraphic:Graphic = new Graphic(event.mapPoint, clickPtSym);
clickGraphicsLayer.add(clickGraphic);
identifyTask.execute(identifyParams, new AsyncResponder(myResultFunction, myFaultFunction, clickGraphic));
}
public static var identify:IdentifyHelper = new IdentifyHelper;
private function onItemClick(event):void
{
switch (this.selectedItem.name)
{
case "Zoning":
identify.myIds = [4];
break;
case "LUP - Area Comm Plan":
identify.myIds = [5];
break;
case "LUP - General Plan":
identify.myIds = [6];
break;
}
}
protected function mapClickHandler(event:MapMouseEvent):void
{
clickGraphicsLayer.clear();
graphiclayer.clear();
var identifyParams:IdentifyParameters = new IdentifyParameters();
identifyParams.returnGeometry = true;
identifyParams.tolerance = 3;
identifyParams.width = map.width;
identifyParams.height = map.height;
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.spatialReference = map.spatialReference;
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.layerIds = com.esri.ags.samples.LayerTOC.identify.myIds;
var clickGraphic:Graphic = new Graphic(event.mapPoint, clickPtSym);
clickGraphicsLayer.add(clickGraphic);
identifyTask.execute(identifyParams, new AsyncResponder(myResultFunction, myFaultFunction, clickGraphic));
}
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/getChildIndex() at mx.managers::SystemManager/getChildIndex()at mx.managers.systemClasses::ActiveWindowManager/mouseDownHandler()
undefined at com.esri.ags.script::IdentifyHelper/set myIds()
package com.esri.ags.script
{
public class IdentifyHelper
{
private var _myIds:Array;
public function get myIds():Array
{
return myIds;
}
public function set myIds(value:Array):void
{
myIds = value;
}
}
}