I am new to flex. Now I am trying to customize the SearchWidget from arcgis-samples-flex-3.6-src. What I want to do is:
(1) use the drawing tools provide in the sample on a layer from the layer list.
(2) get a specified field values of all the features in the drawing area (of the selected layer) in a arraylist.
Now I can access the layer, but I failed to get the expected arraylist (the fieldValues in the following code).
<CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #222222;">private function queryFeaturesGraphical(geom:Geometry):void<BR /> {<BR /> hideInfoWindow();<BR /> var searchLayer:Object = cboLayerGraphical.selectedItem;<BR /><BR /> queryLayer = searchLayer.layer;<BR /> retrieveFieldValue(searchLayer);<BR /> }<BR /><BR />private function retrieveFieldValue(obj:Object):void<BR />{<BR /> CursorManager.removeBusyCursor();<BR /> var fieldset:FeatureSet = obj as FeatureSet;<BR /><BR /> fieldValues = uniqueArray(fieldset.features);<BR />}<BR /><BR />private function uniqueArray(arr:Array) : Array <BR />{<BR /> var unique : Array = new Array();<BR /> var contains : Boolean;<BR /><BR /> for( var i:Number = 0; i<arr.length; i++ ) <BR /> {<BR /> contains = false;<BR /> unique.push(arr<I>); <BR /> }<BR /> return unique;<BR /> }<BR />}</I>
What I use is arcgis flex api 3.6 and flash builder 4.6.
Would anybody please advice me what is wrong with my code? thanks.