|
POST
|
Please explain me, what are you discussing about? (1) Map Rotation or (2) device flipping (and map rotation as result of it)? (1) - Clear - it works. (2) - Need to write code around it 😄 onRetainNonConfigurationInstance() NB! This method is deprecated. public void onCreate(Bundle savedInstanceState) {
// ...
mapView = (MapView) findViewById(R.id.map);
// ...
Object[] init = (Object[]) getLastNonConfigurationInstance();
if (init != null) {
mapView.restoreState((String) init[0]);
tiledMapServiceLayer = (ArcGISTiledMapServiceLayer) init[1];
graphicsLayer = (GraphicsLayer) init[2];
} else {
mapView.setExtent(new Envelope(-85.61828847183895, 38.19242311866144, -85.53589100936443, 38.31361605305102));
tiledMapServiceLayer = new ArcGISTiledMapServiceLayer(this, mapURL);
graphicsLayer = new GraphicsLayer(this);
}
// ...
}
// ...
public Object onRetainNonConfigurationInstance() {
Object appState = new Object[] { mapView.retainState(), tiledMapServiceLayer, graphicsLayer };
mapView.removeAll();
return appState;
}
setRetainInstance(boolean) We has no time to try it ... So, when you solve problem paste your code. Good luck. P.S. This link (PDF) as bonus (contains link to WaterServiceApplication sample)
... View more
03-16-2012
01:07 AM
|
0
|
0
|
872
|
|
POST
|
Legend for 2 standalone layers. (code) - only selected service visible in Legend component. Show your code. (it's easyest way to find bugs in your code)
... View more
03-15-2012
10:19 PM
|
0
|
0
|
892
|
|
POST
|
this functionality will be shown in rest service or not. Nadir, HTML && REST can you see visible scale range?
... View more
03-15-2012
06:03 AM
|
0
|
0
|
320
|
|
POST
|
Sarah, This tested with IE8 and IE9 (Flash player versions 10.3 & 11.1) - no issues detected. disableClientCaching If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache. refresh Causes the layer to redraw or reload its content. Show your code. P.S. Adobe flash player bugs base.
... View more
03-15-2012
05:42 AM
|
0
|
0
|
535
|
|
POST
|
From reference addLayer: ...Adds a layer to the map. If an ID was not defined, a unique name will be created and assigned to the layer. The unique name is created using NameUtil.createUniqueName, which will combine the unqualified class name with an incrementing counter to create something like "Layer2"... if you find MapManager.mxml in Flex Viewer application (v 2.5) sources (~ line 620) - layer id is defined and it is the same as layer name var featureLayer:FeatureLayer = new FeatureLayer(url);
...
featureLayer.id = label; // <layer label="Test" ...> in config.xml
featureLayer.name = label; // <layer label="Test" ...> in config.xml
...
map.addLayer(featureLayer);
... In your situation: var layerId:String="Test"; // <layer label="Test" type="feature" ...> in config.xml
var myLayer:FeatureLayer = map.getLayer(layerId) as FeatureLayer;
... View more
03-13-2012
04:17 AM
|
0
|
0
|
786
|
|
POST
|
Leen, 1- so it cannot work with "getlayer"? No, map.getLayer(layerid) works, if you know valid layer id, do you know it? The function getLayer is not the problem - it works as all other functions. The problem is: you do not know valid layer id -> actual questions are: "How can i get valid layer id?" (map.layerIds) or "What other ways to get layer from map?" (my last post) 2- Type was not found or was not a compile type constant: Layer. Think before you write :confused: import com.esri.ags.layers.Layer; Read documentation of... hei, Leen do you understand what difference between ArcGIS API (application programming interface) fo Flex vs. ArcGIS Viewer for Flex? The Viewer for Flex is just sample application. (With great functionality and interface, extendable ... but still sample application, better one, but still...) The confix.xml <layer> tag in Viewer for Flex and Layer in Flex API reference are not equals things. Good luck. 😄
... View more
03-13-2012
03:28 AM
|
0
|
0
|
786
|
|
POST
|
How to GET:
private var myLayer:FeatureLayer = null;
private var myLayerName:String = "Test"; // defined in config.xml <layer label="Test"... initialized in MapManager.mxml
protected function onWidgetOpened(event:Event):void
{
if (!myLayer) // if (myLayer == null)
{
initializeMyLayer();
}
}
private function initializeMyLayer():void
{
if (map)
{
var layer:Layer = null;
for each (layer in map.layers)
{
if (layer is FeatureLayer && layer.name == myLayerName) //any other conditions (id, visibility, loaded or not, ...)
{
myLayer = layer as FeatureLayer;
break;
}
}
}
} How to ADD:
private var myLayer:FeatureLayer = null;
private var myLayerName:String = "Test"; // defined in config.xml <layer label="Test"... initialized in MapManager.mxml
protected function onWidgetOpened(event:Event):void
{
if (!myLayer) // if (myLayer == null)
{
initializeMyLayer();
}
}
private function initializeMyLayer():void
{
if (map)
{
var layer:Layer = null;
for each (layer in map.layers)
{
if (layer is FeatureLayer && layer.name == myLayerName) //any other conditions (id, visibility, loaded or not, ...)
{
myLayer = layer as FeatureLayer;
break;
}
}
if (!myLayer)
{
addMyLayer();
}
}
}
private function addMyLayer():void
{
if (map)
{
myLayer = new FeatureLayer("serviceUrl");
// set other needed params (http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html)
var myLayerId:String = map.addLayer(myLayer);
trace("Feature layer added. Layer id=" + myLayerId);
}
} As you can read in documentation (Flex Viewer version 2.5) about config.xml layer tag (if you can read), <layer> has no id attribute. wrong code ... <operationallayers> <layer label="Test" type="feature" id="idlayer" url="http://trainingcloud.arcgis.com/ArcGIS/rest/services/Redlands_Collisions2008/MapServer/0"/> So what documentation you read? Can you provide me with link.
... View more
03-13-2012
01:58 AM
|
0
|
0
|
786
|
|
POST
|
Farhad, ... I don't define the columns in the code ... So where is this place you define it? ... The columns come from the query results and are set dynamically ... I have not found documentation that confirms this statement. :confused: Query result is feature set. Try it, may be it helps you. <?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:mx="library://ns.adobe.com/flex/mx"> <!-- Adobe Flex SDK 4.5.1 --> <!-- ArcGIS API for Flex 2.5 --> <!-- http://web.zone.ee/bespiva/queryresults/ --> <s:layout> <s:VerticalLayout gap="10" paddingLeft="10" paddingBottom="10" paddingRight="10" paddingTop="10"/> </s:layout> <fx:Script> <![CDATA[ import com.esri.ags.FeatureSet; import com.esri.ags.Graphic; import com.esri.ags.events.LayerEvent; import com.esri.ags.layers.FeatureLayer; import com.esri.ags.layers.supportClasses.Field; import com.esri.ags.tasks.supportClasses.Query; import mx.collections.ArrayCollection; import mx.rpc.AsyncResponder; import mx.rpc.Fault; import mx.utils.StringUtil; import spark.components.gridClasses.GridColumn; [Bindable] private var gridSource:ArrayCollection = new ArrayCollection(); [Bindable] private var gridColumns:ArrayCollection = new ArrayCollection(); private var queryLayer:FeatureLayer = null; private function initializeLayer():void { queryLayer = new FeatureLayer(txtServiceUrl.text); queryLayer.mode = FeatureLayer.MODE_ON_DEMAND; queryLayer.outFields = new Array("*"); queryLayer.addEventListener(LayerEvent.LOAD, onLayerLoaded, false, 0, true); dispatchEvent(new LayerEvent(LayerEvent.LOAD, queryLayer)); } protected function onLayerLoaded(event:LayerEvent):void { queryLayer.removeEventListener(LayerEvent.LOAD, onLayerLoaded); txtServiceUrl.editable = false; executeQuery(); } protected function onExecuteButtonClick(event:MouseEvent):void { if (queryLayer != null && queryLayer.loaded) { executeQuery(); } else { initializeLayer(); } } private function executeQuery():void { var query:Query = new Query(); query.where = txtWhere.text; query.returnGeometry = false; var outs:Array = StringUtil.trim(txtOuts.text).split(","); query.outFields = queryLayer.outFields = outs; queryLayer.queryFeatures(query, new AsyncResponder(onQueryResult, onQueryFault)); } protected function onQueryResult(featureSet:FeatureSet, token:Object = null):void { gridSource = new ArrayCollection(); lblResultsCount.text = StringUtil.substitute("Found: {0} features.", featureSet.features.length); for each(var gr:Graphic in featureSet.features) { gridSource.addItem(gr.attributes); } gridSource.refresh(); gridColumns = new ArrayCollection(); for each (var field:Field in featureSet.fields) { var gridColumn:GridColumn = new GridColumn(field.alias); gridColumns.addItem(gridColumn); } gridColumns.refresh(); } protected function onQueryFault(fault:Fault, token:Object = null):void { trace(fault.getStackTrace()); } ]]> </fx:Script> <s:Panel width="100%" title="Query parameters"> <s:VGroup gap="5" paddingLeft="5" paddingTop="5" paddingRight="5" paddingBottom="5" width="100%"> <s:HGroup width="100%"> <s:Label text="Url:" width="150" /> <s:TextInput id="txtServiceUrl" width="100%" text="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5" /> </s:HGroup> <s:HGroup width="100%"> <s:Label text="Where clause:" width="150" /> <s:TextInput id="txtWhere" width="100%" text="1=1" /> </s:HGroup> <s:HGroup width="100%"> <s:Label text="Out fields (CSV):" width="150" /> <s:TextInput id="txtOuts" width="100%" text="STATE_NAME,STATE_FIPS,SUB_REGION,STATE_ABBR,POP2000,POP2007" /> </s:HGroup> <s:HGroup width="100%"> <s:Button label="Execute" click="onExecuteButtonClick(event)" /> </s:HGroup> </s:VGroup> </s:Panel> <s:Panel title="Results" width="100%" height="100%"> <s:VGroup gap="5" paddingLeft="5" paddingTop="5" paddingRight="5" paddingBottom="5" width="100%" height="100%"> <s:Label id="lblResultsCount" /> <s:DataGrid width="100%" height="100%" dataProvider="{gridSource}" columns="{gridColumns}"/> </s:VGroup> </s:Panel> </s:Application>
... View more
03-12-2012
01:35 PM
|
0
|
0
|
1012
|
|
POST
|
Kathleen, 1 - Can you delete feature using "ArcGIS Services Directory"? http://server name/ArcGIS/rest/services/service name/FeatureServer/0/applyEdits 2 - applyEdits(adds:Array, updates:Array, deletes:Array, responder:IResponder = null):AsyncToken deletes:Array â?? Array of features to delete. Must have valid objectId. so try validate feature object id: if (logBook.selectedFeatures.length > 0)
{
var selectedGraphic:Graphic = logBook.selectedFeatures[0];
var attributes:Object = selectedGraphic.attributes;
var oidField:String;
var oidValue:Number;
if (logBook.layerDetails != null)
{
oidField = logBook.layerDetails.objectIdField;
}
if (oidField != null)
{
if (attributes != null && attributes.hasOwnProperty(oidField))
{
oidValue =attributes[oidField];
}
}
else
{
trace("Something wrong with layer objectId field");
}
if (oidValue != null && oidValue > 0)
{
var deletes:Array = new Array(selectedGraphic);
logBook.applyEdits(null, null, deletes, new AsyncResponder(onEditResult, onEditFault));
}
else
{
trace("Selected feature has no objectId value and can not be deleted!");
}
}
... View more
03-08-2012
03:54 AM
|
0
|
0
|
1679
|
|
POST
|
Take a look to first sample in this post http://forums.arcgis.com/threads/48905-Legend-component-rendering-issue?p=169901#post169901.
... View more
03-07-2012
11:31 PM
|
0
|
0
|
892
|
|
POST
|
Kathleen, Your fault in creating new deletes array. Try it: if (logBook.selectedFeatures.length > 0)
{
var selectedGraphic:Graphic = logBook.selectedFeatures[0];
var deletes:Array = new Array(selectedGraphic);
logBook.applyEdits(null, null, deletes, new AsyncResponder(onEditResult, onEditFault));
}
... View more
03-07-2012
11:23 PM
|
0
|
0
|
1679
|
|
POST
|
Farhad, spark.components.DataGrid <s:DataGrid>
<s:columns>
<s:ArrayList>
<!-- Define columns propeties here -->
<s:GridColumn dataField="filedName4"/>
<s:GridColumn dataField="filedName2"/>
<s:GridColumn dataField="filedName1"/>
<s:GridColumn dataField="filedName3"/>
</s:ArrayList>
</s:columns>
</s:DataGrid>
... View more
03-06-2012
10:49 AM
|
0
|
0
|
1012
|
|
POST
|
David, as a start point search in Flex API (Viewer) forums: http://forums.arcgis.com/search.php - set "ExternalInterface" as keyword
... View more
03-06-2012
01:27 AM
|
0
|
0
|
543
|
|
POST
|
Harold, look at: http://kinderas.blogspot.com/2008/12/quicktip-mouseover-vs-rollover.html http://theactionscripter.com/2009/09/29/as3-mouse_over-vs-roll_over.aspx
... View more
03-05-2012
09:52 AM
|
0
|
0
|
416
|
|
POST
|
Sierk, Cannot access a property or method of a null object reference. just fill the difference: output: "Hello world!"
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());
} output: "Error #1009: Cannot access a property or method of a null object reference."
try
{
var myObject:Object = new Object(); // myObject is null
var message:String = myObject.myParameter;
trace(message);
}
catch (error:Error)
{
trace(error.message.toString());
} How to debug your application - adobe help Add and remove breakpoints - adobe help The Flash Debug perspective (Variables view) - adobe help
... View more
03-04-2012
10:35 AM
|
0
|
0
|
1035
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-03-2017 11:25 PM | |
| 1 | 10-06-2016 11:49 PM | |
| 2 | 06-07-2012 01:38 AM | |
| 1 | 06-03-2012 09:42 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|