0% found this document useful (0 votes)
683 views187 pages

ArcGIS With Flex

PDF version of Online guide of ArcGIS with Flex from https://developers.arcgis.com/flex/guide/guide.htm
Copyright
© Public Domain
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
683 views187 pages

ArcGIS With Flex

PDF version of Online guide of ArcGIS with Flex from https://developers.arcgis.com/flex/guide/guide.htm
Copyright
© Public Domain
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 187

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.

htm

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Add a map and layers


In this topic

Add an Esri namespace reference

Add a map and data to the UI

Version 3.7
The steps below will guide you through displaying a map with a basemap layer in your
application. We assume that you have already created a blank project with the referenced API
library as discussed in the Getting started section.
The primary way to display geographic information in your application is through a map. The
Flex API provides a user interface (UI) Map component. This component lets you display
content by either working with layers referencing various web services such as ArcGIS Server
Map and image services, Open Street Map, Bing Maps, OGC WMS etc. or by referencing
preconfigured web maps from ArcGIS Online (Esri's cloud), or your own on-premise ArcGIS
portal(s).
Flex applications are developed using the MXML and ActionScript languages with the
ActionScript class library. MXML can be compared to HTML, as it uses tags to lay out the page.
Whereas Actionscript can be compared to Javascript, as this is where the code and logic usually
reside.
We are going to work strictly in MXML for this tutorial by adding a map UI component to the
project initially created in the Getting started topic.

Add an Esri namespace reference


The first step in displaying a map in your application is to reference the ArcGIS API for Flex
library in the MXML. You will do this by adding the Esri namespace. This is added as a property
of the application or component you are building.

In the Editor view, modify the MXML markup to read


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
xmlns:esri="http://www.esri.com/2008/ags">
</s:Application>

Now that you added the namespace reference to your markup. You can begin writing
code.

Add a map and data to the UI


The next step is to add a map component to your application's UI. This component will act as an
empty canvas to which you will later add map content.

Add the following markup in the Editor view underneath the namespace reference added
above.

<?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/halo"
xmlns:esri="http://www.esri.com/2008/ags">
<esri:Map level="3" wrapAround180="true">
<esri:center>
<esri:WebMercatorMapPoint lon="0" lat="0"/>
</esri:center>
</esri:Map>
</s:Application>

Next, add the ArcGISTiledMapServiceLayer as the basemap layer to the map. Add
theArcGISDynamicMapServiceLayer displaying world population density onto the basemap
layer.

....
<esri:Map level="3" wrapAround180="true">
<esri:center>
<esri:WebMercatorMapPoint lon="0" lat="0"/>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

</esri:center>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/
World_Street_Map/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Demographics/ESRI_Population_World/MapServer"
alpha=".70"/>
</esri:Map>

Run the application

The MXML above adds the esri:Map component to the application with a set level and center. In
addition to the Map container, you are also adding a tiled map service layer pointing to a REST
URL hosting a cached map service and a dynamic map service layer. Upon launching the
application, the map displays the tiled map service layer at the third level of detail centered on a
latitude and longitude of zero with the dynamic map service layer layered on top.
Tip:

Remember when writing code, it should always contain at least a namespace andActionScript
code and/or MXML tags.

Add a web map


In this topic

Quick overview

Access web map identifer

Add the web map to the application

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Version 3.7

Quick overview
An ArcGIS web map is a basemap and a related set of layers that users can interact with to
perform some meaningful task. These maps are available to a wide audience and include
multiscale basemaps, operations layers targeted to a specific audience, and pop-up windows that
allow users to focus on specific features of interest, as well as other data formats (text files,
shapefiles, KML, etc). These web maps are viewable on a wide variety of clients including
mobile devices, desktop applicaitons, and web browsers. For more information regarding
working with ArcGIS Online web maps, see the ArcGIS.com Help section.

Access web map identifer


There are two methods of adding data to the map component. The first method is described in
the Add a map with layers tutorial. The other method is to author a web map using either
the ArcGIS.com Viewer or, if applicable, Portal for ArcGIS. Once authored, the web map can
then be shared as a resource and accessed via its unique item ID.

Note:

This tutorial assumes that you are familiar with creating web maps. If you are not, see the Create
a web map tutorial.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

After creating the web map, copy the web map ID to use within this tutorial. To find the ID, view
your web map in either ArcGIS.com or, if applicable, Portal for ArcGIS, and notice that the URL
includes the unique map identifer. An example of this is displayed below.

Add the web map to the application


The WebMapUtilclass is used to create a map by reading item information from the web map
based on a given ID. This class works with web maps from ArcGIS Online, and can also use
Portal for ArcGIS by setting the arcgisSharingURL property. This tutorial uses a web map hosted
from ArcGIS Online.
Note:

The following steps assume you have completed the steps necessary to create a new project and
add the Flex API library as discussed in the Getting started topic.
1. In Flash Builder, create a new project and make certain to add the Flex API library.
2. In the Editor View add the following code. Also make certain to reference the esrinamespace.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.

<?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"
initialize="application_initializeHandler(event)">
<fx:Script>
<![CDATA[
import com.esri.ags.events.WebMapEvent;
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function application_initializeHandler(event:FlexEvent):void
{
webMapUtil.createMapById("4778fee6371d4e83a22786029f30c7e1");
}
protected function webMapUtil_createMapByIdCompleteHandler(event:WebMapEvent):void
{
addElementAt(event.map, 0);
}
]]>
</fx:Script>
<fx:Declarations>
<esri:WebMapUtil id="webMapUtil"
createMapByIdComplete="webMapUtil_createMapByIdCompleteHandler(event)"
fault="Alert.show(event.fault.faultString);"/>
</fx:Declarations>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


33.
34. <s:Label top="10"
35.
fontSize="24"
36.
horizontalCenter="0"
37.
text="ArcGIS.com Web Map"/>
38.
</s:Application>

39. Run the application

You should now have a web application displayed similarly to the screen capture above.
Conceptually, this is how the code breaks down:

The initializeHandler is fired when the application initializes and the map is created
using the provided web map ID, e.g. 4778fee6371d4e83a22786029f30c7e1.
Once the map is created and complete, the createMapByIdCompleteHandler is fired. This
event calls the Spark container's addElement function passing in the map.

Note:

The ID is provided as an example, you can swap this out for one of your own.

Query your data


In this topic

Steps to query data

Set the Map and GraphicsLayer

Set the QueryTask

Executing the query

Version 3.7
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Steps to query data


In this tutorial, you will learn how to work with a query task to query data from an ArcGIS
service. There is typically four steps involved in the query process:
1.
2.
3.
4.

Set the Map and GraphicsLayer.


Set the QueryTask using a query filter.
Execute the QueryTask with user inputs.
Display the query results.
The example used in this tutorial is a query task where you type in the name of a US state. Based
on this input, all states that match the name are displayed on the map.

Set the Map and GraphicsLayer


The Map and its layers are used to provide a context to displaying the query results. The
GraphicsLayer is used to symbolize and display the geometries of the query results. The
following code snippet shows a map with an ArcGIS Server tiled map service layer and a
graphics layer added to the map.
Note:

The following steps assume you have completed the steps necessary to create a new project and
add the Flex API library as discussed in the Getting started topic.
1. In Flash Builder, create a new project and make certain to add the Flex API library and reference
the esri namespace.
2. In the Editor View, add the MXML below including reference to the layout tag.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.

<?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"
xmlns:esri="http://www.esri.com/2008/ags">
<s:layout>
<s:VerticalLayout gap="10"
horizontalAlign="center"
paddingBottom="20"
paddingLeft="25"
paddingRight="25"
paddingTop="20"/>
</s:layout>
</s:Application>

18. Next, add the map, a tiled layer, and lastly a GraphicsLayer for the query results. The next
section will discuss QueryTask which is used in the graphicProvider.
19. ...
20. paddingTop="20"/>
21. </s:layout>
22.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


23. <esri:Map id="myMap">
24.
<esri:extent>
25.
<esri:Extent xmin="-14298000" ymin="2748000" xmax="-6815000" ymax="7117000">
26.
<esri:SpatialReference wkid="102100"/>
27.
</esri:Extent>
28.
</esri:extent>
29.
30.
<esri:ArcGISTiledMapServiceLayer
31.
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer"/>
32.
<esri:GraphicsLayer id="myGraphicsLayer"
33.
graphicProvider="{queryTask.executeLastResult.features}"/>
34. </esri:Map>
35.
</s:Application>

Note:

It is not always necessary to work with a map when performing a query. Another example could
include populating a table with the query results. See this samplefor additional help on doing
this.

Set the QueryTask


The QueryTask is just one of a number of tasks provided by the ArcGIS API for Flex.
Regardless of which task you are working with, each has a unique type of parameter that is used
to define it. For example, the QueryTask works with a Query object as its parameter. The
diagram below depicts this as it illustrates the task working with the defined parameters creates
task results.

In order to access the QueryTask, you first need to set it to a URL of the layer that the query will
work against. The URL includes the layer ID. In the following code snippet, the layer ID is 0.

In Flash Builder's Editor view, add the following code snippet in


the <fx:Declarations>section.

<fx:Declarations>
<!-- Layer with US States -->
<esri:QueryTask id="queryTask"
showBusyCursor="true"

url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA
/MapServer/5"
useAMF="false"/>
<esri:Query id="query"
outSpatialReference="{myMap.spatialReference}"
returnGeometry="true"

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

text="{qText.text}">
<esri:outFields>
<fx:String>MED_AGE</fx:String>
<fx:String>POP2007</fx:String>
</esri:outFields>
</esri:Query>
</fx:Declarations>
<esri:Map id="myMap">
<esri:extent>
...

The query defines the criteria that will be used for executing the query.
SetreturnGeometry="true" if you wish to display the results of the query. In addition,
two fields are specified in the outFields . These two fields could then be displayed in the
output query results.
Tip:

The fewer fields included, the faster the response. Also, use the actual field names rather
than aliases, although aliases can be used in the output task results.

Executing the query


The QueryTask, Query parameter, and resulting FeatureSet work together to query a layer in a
map and display the results. The resulting FeatureSet can contain both features and attribute
information. The diagram below depicts the conceptual flow of this.

In Flash Builder's Editor view, add the following MXML snippet following
the<fx:Declarations> section.

...
</esri:Query>
</fx:Declarations>
<s:Panel height="60"
backgroundColor="0xB2BFC6"
title="Query a layer (search for a state)">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:TextInput id="qText"

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

width="100%"
enter="doQuery()"
text="California"/>
<s:Button click="doQuery()" label="Do Query"/>
</s:Panel>
<esri:Map id="myMap">
<esri:extent>
...

The TextInput allows input of a state name. Once this is entered, the doQuery() function
is called. This then executes the callback function onResult(). One of the arguments to
this function is a FeatureSet that contains the results of the query. The FeatureSet's
features can be directly assigned to the GraphicProvider of the graphics layer rendered
on the map.
In case of a failure, the callback function onFault() is called, which, in the following
example, shows an alert box with information about the failure.
Note:

For the purpose of this tutorial, the results are assigned to the GraphicProvider in the
MXML code, graphicProvider="{queryTask.executeLastResult.features}".

Add the ActionScript code making certain to place it in a fx:Script tag.


paddingTop="20"/>
</s:layout>
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;
private function doQuery():void
{
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
// No code needed in this simple sample, since the
// graphics layer is bound to the query result using
// graphicProvider="{queryTask.executeLastResult.features}"
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
]]>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

</fx:Script>

Save and run the application.


Type in a state name, e.g. California.

<fx:Declarations>
<!-- Layer with US States -->

You should now have a web application displayed similarly to the screen capture above.
Conceptually, this is how the code breaks down:

The queryTask is based off of a layer within a map service. In this case, a 'states' layer of
the US.
The query parameter is set to whatever text is input to the textbox.
The onResult() function is fired after successful completion of the queryTask which, in
turn, passes in the resulting FeatureSet.
The FeatureSet features, ie. graphics, are bound to graphicProvider and subsequently
displayed.

Mobile-specific application
In this topic

Prerequisites

Create a new mobile project

Write code

Run the app

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Additional Information

Version 3.7

Prerequisites
In this tutorial you will create a basic Flex mobile application that displays a basemap. Before
doing this, you will need to make sure you have the following:

Adobe Flash Builder 4.5.1 (or later)


The updated Adobe AIR SDK overlayed on the Flex SDK. If you are uncertain of how to
do this, see Adobe's document, Overlay AIR SDK on Flex SDK.
Caution:

Flex users will need to download the original AIR SDK without the new compiler. Mac
users click here Windows users click here.

Downloaded copy of the ArcGIS API for Flex.

Create a new mobile project


The following steps illustrate what you will need to do to create a new mobile project using
Flash Builder 4.5.1 or higher. In this specific tutorial, we are targeting an Android device. The
steps provided below will work the same regardless of whether you choose to target an Android
device or iOS.
1. In Flash Builder, click File > New > Flex Mobile Project.
2. Specify a project name, e.g. MyBaseMap and a project location.
3. Specify the Flex SDK you configured to embed the Adobe AIR SDK into Flex SDK, clickNext.
More information on how to do this can be found here.
Note:

If this SDK is not listed, click the Configure Flex SDKs... link and browse to the location of the
newly configured SDK.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

4. Under the Mobile Settings tab, check Google Android and keep the default settings and
click Next.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

5. (Optional) click the Permissions button and you can specify which permissions are allowed on
the device at runtime. For the purpose of this tutorial, keep the defaults, click Next.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

6. Under the Server Settings tab, keep all defaults, click Next.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

7. Under the Build Paths tab, click Add SWC... and browse to the location of the downloaded Flex
API. Keep the defaults for folder, file, and ID names.
Note:

For the purpose of this tutorial, we are not changing the Application ID. This is not practical in a
real-world deployment scenario. Here, you would want to give your Application ID a fully
qualified domain name, e.g. com.mydomain.myApp.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Write code
Currently, the app does not contain anything. In this next section we will provide the code to add
a simple basemap to the app.
In Flash Builder, make certain the MyBaseMapHomeView.mxml (or whatever name you called
your application) tab is active and the file is visible.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Inside the Editor view, add the following code and save.
<?xml version="1.0" encoding="utf-8"?>
<s:View
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
title="A tiled map service">
<esri:Map id="myMap"
attributionVisible="false"
level="2"
wrapAround180="true"
zoomSliderVisible="false">
<esri:extent>
<esri:Extent xmin="-19325128" ymin="-10948057"
xmax="-539964" ymax="18364625">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
</esri:Map>
</s:View>

Run the app


Now that you added the code portion to your project, you are ready to run it. Although it is
always preferable to debug and test your app on an actual physical device, it is possible to test it
out directly on your desktop. Flash Builder provides easy functionality that makes this possible.
The steps below go over this:
1. With the MyBaseMapHomeView.mxml (or whatever name you called it) open and active, click
the Run button.
2. In the Run Configurations dialog box, make certain that Google Android is the target platform.
3. Do not change the AppID.
4. Under the Launch method dropdown, select On AIR Simulator.
5. Under the Launch Configuration dropdown, select a device. E.g. Motorola Droid, click Apply
and Run.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The result should display similar to the screen capture below.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Note:

If using version 3.4 or above, you may receive an error upon running, Class mx.controls::
DateField could not be found. Class com.esri.ags.skins.fieldClasses::CalendarField could not be
found . If this occurs, please see Mobile applications with Flex and/or the section discussing it in
theFAQs.

Additional Information
The steps provided above are given as a basic tutorial and are not all-encompassing. For further
information, please refer to Adobe's document for developing mobile applications.
The ArcGIS API for Flex provides mobile samples that demonstrate some of the above
functionality. If you wish to explore these samples, please see the ArcGIS API for Flex samples
on GitHub.
Note:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

If you are using certain mx components, you will need to include the mx.swc among the project
libraries. You might also want to include sparkskins.swc. SeeMobile applications with Flex for
more information.
Caution:

There is a known-limit when working with pop-up windows in mobile applications created with
version 3.1. If doing so, please note that you will need to either: Add
both mx.swc and sparkskins.swc to your project, or update PopUpRendererSkin and remove
references to the RelationshipInspector.

Access feature data in the cloud


In this topic

Add data from a feature service

Additional Resources

Version 3.7
Web editing requires a feature service to provide the symbology and feature geometry of your
data. Feature services allow you to create custom REST endpoints to store and query geographic
data such as points, lines and polygons. Store custom rendering rules and metadata such as place
names, ratings and addresses. Run analysis and computations against your stored data. Create
hosted tile sets with baked-in feature services.
The ArcGIS API for Flex provides a FeatureLayer that allows you to access and edit vector map
data. Feature services are accessible via a feature layer. Feature layers can do a variety of things
and can reference a layer in either a map service or a feature service. However, when you use a
feature layer for editing purposes you need to reference a layer in a feature service.
Web editing requires some initial setup of a feature service, which exposes information about a
layer's feature geometries and attributes. Also, geometry services can be used to accomplish
some Web editing tasks. In order to use the main Editor component, for example, you must have
a running geometry service.
When you perform editing, your Web application tells the feature layer which attributes have
changed and, if applicable, how the geometry changed. The feature layer also displays the
updated features after editing. The feature services can be hosted on ArcGIS Online (Esri's
cloud) or on your on-premise servers.
Note:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The following steps assume you have completed the steps necessary to create a new project and
add the Flex API library as discussed in the Getting started topic.

Add data from a feature service


Adding data from a feature service is as simple as instantiating a feature layer and adding it to
your map. To instantiate the layer, all you need is a URL to the feature service you're going to
use, and optionally, the user credentials to access that service. The service you're using in this
topic is public, so you do not need to provide any credentials. After adding the layer to the map,
you'll add a reference to a geometry service.
1. In Flash Builder, create a new project and make certain to add the Flex API library and reference
the esri namespace.
2. In the Editor View, add the MXML below to create a map with a set spatial reference and extent,
add a basemap layer, and lastly add a feature layer by referencing a specified feature service
layer's URL.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.

<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"
<esri:Map id="myMap" wrapAround180="true">
<esri:extent>
<esri:Extent id="socal"
xmin="-13471000" ymin="3834000" xmax="-12878000" ymax="4124000">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:FeatureLayer id="incidentsAreas"
mode="snapshot"
outFields="[data_security,description]"

url="http://sampleserver6.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureS
erver/2"/>
22. </esri:Map>
...

23. In the Editor View, add the MXML below declaring the geometry service.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.

xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
<fx:Declarations>
<esri:GeometryService id="myGeometryService"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
</fx:Declarations>
<esri:Map id="myMap" wrapAround180="true">
<esri:extent>
</s:Application>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

35. In the Editor View, add the MXML below including reference to the Editor component. This
component bundles much of the editing functionality up in one component so that all you need to
do is reference it within your code with a corresponding geometry service.
36. <esri:FeatureLayer id="incidentsAreas"
37.
mode="snapshot"
38.
outFields="[data_security,description]"
39.
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureS
erver/2"/>
40. </esri:Map>
41.
42.
<esri:Editor id="myEditor"
43.
width="100%" height="200"
44.
geometryService="{myGeometryService}"
45.
map="{myMap}"/>
46.
...

47. Next, add an initialize handler function and reference it within the application.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.

...
xmlns:esri="http://www.esri.com/2008/ags"
initialize="application1_initializeHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function application1_initializeHandler(event:FlexEvent):void
{
myEditor.featureLayers = [ incidentsAreas ];
}
]]>
</fx:Script>

61. Last, save and run the application.


You probably notice that the Editor component displays horizontally across the top of the
application. Let's adjust this slightly to make it easier to use within the application.
62. Modify the code snippet to add a layout tag to help enhance the UI.
63. ...
64. initialize="application1_initializeHandler(event)"
65.
66. <s:layout>
67.
<s:VerticalLayout/>
</s:layout>

68. Next, let's add a snippet working with the style tag. This allows us to slightly alter the
infowindow component that displays after creating a new feature.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.

...
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace esri "http://www.esri.com/2008/ags";

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


79.
esri|InfoWindow
80.
{
81.
background-color: #FFFFFF;
82.
border-thickness: 2;
83.
}
84. </fx:Style>
85.
86. <fx:Script>
87.
88.
<![CDATA[
89.
import mx.events.FlexEvent;
90.
...

91. Run and save the application.


92. Click on one of the Editor component's feature templates and digitize an area within the map.
Once you finish the feature, you should notice an infowindow display. This is where you could
edit the attributes of the given feature.
You should now see something similar to the screen capture below.

Accessing data from the cloud is not difficult to accomplish while working with the Flex API. In
this particular example, we worked with the Editor component which handles a lot of the editing
complexity for you. We were able to create a simple web mapping application with access to
editable feature data in the cloud in just a matter of a few steps. Conceptually, this is how the
code breaks down:

Reference the map, add layers, and lastly get a reference to an editable feature service.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Get a reference to a geometry service since it works in conjunction with the Editor
component.
Instantiate the Editor component and set its associated geometry service and map.
Wire the application's initialize handler upon startup of the application so that it
instantiates the Editor component correctly.
Lastly, modify the UI so that it is easier to work within the application.

Additional Resources
If you are interested in learning more on editing web applications using the Flex API, see
the Editing topic where much of the information above is provided in greater detail.

Find places and addresses


In this topic

Find locations quickly

Additional information

Version 3.7

Find locations quickly


The Geocoder component provides easy map navigation by adding a search box. This search box
enables you to move to a location much quicker and easier than standard panning/zooming. The
search box provides the search capabilities based on a given locator service and/or map services.
Prerequisites

Adobe Flash Builder 4.5.1 (or later)


Download a copy of the ArcGIS API for Flex. The Geocoder component was made
available at version 3.2 so make certain to download this version or later.

Note:

The following steps assume you have completed the steps necessary to create a new project and
add the Flex API library as discussed in the Getting started topic.
1. In Flash Builder, create a new project and make certain to add the Flex API library and reference
the esri namespace.
2. In the Editor View, add the MXML below to create a map with a set spatial reference and extent
and add a basemap layer
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

<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">
<esri:Map id="map">
<esri:extent>
<esri:WebMercatorExtent xmin="-20119163" ymin="1160734" xmax="-1333999" ymax="10416341"/>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer/>
</esri:Map>
</s:Application>

Note:

The ArcGISTiledMapServiceLayer.url defaults


tohttp://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer .
14. Next, add the Geocoder component.
Note:

No Geocoder URL is set as it defaults to the ArcGIS Online World Geocoding Service. This can
be set to work with another defined geocoding service, or layers within a map service. If using
your own geocode locator service, it will need to be configured to use single line style similar to
how the default locator service is configured.
...
<esri:ArcGISTiledMapServiceLayer/>
</esri:Map>
<esri:Geocoder
width="300"
height="30"
top="20"
horizontalCenter="0"
map="{map}"/>
</s:Application>

15. Last, save and run the application.


16. Enter a place or address to find.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

You should see something similar to what is displayed in the screen capture below.

Finding places and addresses does not require a lot of coding when working with the provided
Geocoding component. This component bundles a lot of the functionality within it so all you
need to do is reference it in your code. We were able to determine a provided place name in just
a few steps. Conceptually, this is how the code breaks down:

Set a map with a given extent and spatial reference


Add a basemap layer
Add the Geocoding component

Additional information
If you are interested in reading more about finding place and address functionality, please see
the Geocoder topic.

Route and navigate


In this topic

Add turn-by-turn directions to a page

Version 3.7

Add turn-by-turn directions to a page


The Directions component calculates directions between two or more locations. It adds a driving
route to the map and provides turn-by-turn instructions. This tutorial describes how to add the
Directions component to a map, customize the page layout to show the component in a side bar
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

next to the map and (optionally) specify your own network analysis service instead of the default
routing service.
Prerequisites

Adobe Flash Builder 4.5.1 (or later)


Download a copy of the ArcGIS API for Flex. The Directions component was made
available at version 3.2 so make certain to download this version or later.
An ArcGIS.com subscription with World Network Analysis is required. Alternatively,
you could use your own ArcGIS Server Network Analysis service.

Note:

The following steps assume you have completed the steps necessary to create a new project and
add the Flex API library as discussed in the Getting started topic.
1. In Flash Builder, create a new project and make certain to add the Flex API library and reference
the esri namespace.
2. In the Editor View, add the MXML below to create a map with a set spatial reference and extent
and add a basemap layer
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.

<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">
<esri:Map id="map">
<esri:extent>
<esri:WebMercatorExtent xmin="-13055785" ymin="3848161" xmax="-13025898"
ymax="3866239" spatialReference="{new SpatialReference(102100)}"/>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer/>
</esri:Map>
</s:Application>

Note:

The ArcGISTiledMapServiceLayer.url defaults


tohttp://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer .
16. In the Editor View, add the MXML below including reference to the layout tag.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.

<?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"
<s:layout>
<s:HorizontalLayout paddingLeft="2"/>
</s:layout>
<esri:Map id="map">
<esri:extent>
...

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The above markup sets the padding on the left-hand side as to allow the directions component to
display next to the map.
28. Next, add the Directions component.
Note:

The Network Analyst service URL is referencing a sample from ArcGIS Online. This is limited
to San Diego's extent. If you wish to work outside of this area, you will need to either: 1) access
an ArcGIS.com subscription with World Network Analysis, or 2) use your own ArcGIS Server
Network Analysis service.
...
<s:layout>
<s:HorizontalLayout paddingLeft="2"/>
</s:layout>
<esri:Directions width="320" height="100%"
map="{map}"
url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Ro
ute"/>
<esri:Map id="map">
<esri:extent>
...

29. Last, save and run the application.


30. Enter your locations to route. You can do this by either: 1) typing in the address, or 2) clicking
on a point on the map using the input tool provided to the right of the input box.

Calculate the driving directions after entering the destinations. You should see something similar
to what is displayed in the screen capture below.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Calculating directions does not require a lot of coding when working with the provided
Directions component. This component bundles a lot of the functionality within it so all you need
to do is reference it in your code. We calculated simple driving directions in just a few steps.
Conceptually, this is how the code breaks down:

Set a map with a given extent and spatial reference


Add a basemap layer
Add the Directions component specifying the URL of the Network Analyst routing
service
Modify the page layout so that the component displays on the left-hand side of the
application

Create a map
In this topic

Map overview

Create a map and set its extent and spatial reference

Work with a web map

Additional references

Version 3.7

Map overview
There are a couple of different ways to work with maps in the Flex API. The first is to add
various layers (services) to the map. These layers can originate from ArcGIS for Server, Bing

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Maps, graphics layers, etc. The other option is to work with web maps shared from a portal such
as ArcGIS.com or one hosted on-premise. Web maps provide similar functionality as they can
contain various layer types, tasks, and data from an external source, (e.g. .csv files and .gpx files
to name a couple). The main difference is that all of this is bundled up within the web map itself.
We will discuss these two options in a bit more detail below.

Create a map and set its extent and spatial reference


The map component acts as a container onto which one or more map layers are drawn.
Establishing the map is usually a preliminary step in building a functional application. A
developer can write code to create a map and then add basemap and operational layers to it. For
additional information regarding the various basemap and operational layer types, please refer to
the 'Types of layers' section within this guide.
Extent

After the map is set, you can also apply an extent and spatial reference to it. The extent of all the
layers in a map service is what is used to determine the map extent provided by this service. This
is important when determining the initial extent displayed in a web application. By default, the
initial extent is determined by the first layer in the map's layer collection, generally referred to as
the basemap. If you do not wish to use this initial default extent, you can modify it by setting it
using Extent .
Set the map and extent
...
<fx:Declarations>
<esri:Extent id="initialExtent"
xmin="-17731" ymin="6710077" xmax="-12495" ymax="6712279">
</esri:Extent>
</fx:Declarations>
<esri:Map extent="{initialExtent}">
</esri:Map>

Note:

More information regarding working with extent can be found at Using Extent.
Spatial reference

Every map service has a spatial reference. This spatial reference can be either set as unprojected
(Geographic) or projected (e.g. UTM, Web Mercator, etc.). There are many coordinate systems
used throughout the world today, depending on which part of the earth being mapped. A very
common one used throughout web mapping applications is Web Mercator (Auxillary Sphere).
This coordinate system is used by Bing Maps, Google Maps, and Esri's ArcGIS Online. A listing
of of WKIDs and their corresponding coordinate system is provided at Coordinate system IDs.
Similar to how the extent gets set by the first layer in the map's layer collection, the spatial

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

reference of the map is set by the first layer in the layer collection. Alternatively, you could
change this by setting the spatial reference using SpatialReference .
Set the map, its extent and spatial reference, and add a tiled layer.
...
<fx:Declarations>
<esri:Extent id="initialExtent"
xmin="-17731" ymin="6710077" xmax="-12495" ymax="6712279">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</fx:Declarations>
<esri:Map extent="{initialExtent}">
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
</esri:Map>
...

Note:

Tiled layers such as ArcGISTiledMapServiceLayers , must support the spatial reference of the
map. They cannot be reprojected to another spatial reference like dynamic map service
layers, ArcGISDynamicMapServiceLayers .
This snippet of code would display a tiled layer in your map with its initial extent centered on
London as seen below.

Level and center of map

Similar to setting the extent of the map, you can also zoom to a specified level and center on a
given lat/lon point. The level refers to the level of detail (LOD) ID for the map. This is only valid
if the map has LODs. For example, the cached World Street map
service, http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer
, has 20 LODs. You can reference this by browsing to its service directory and taking note of
the Tile Info provided. The following code snippet references this service and zooms to level
15. It also centers the map on the provided point specified via its lat/lon coordinates.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


<esri:Map level="15" wrapAround180="true">
<esri:center>
<esri:WebMercatorMapPoint lon="-0.13" lat="51.51"/>
</esri:center>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
</esri:Map>

The code snippet above would display similar as the snippet using Extent . Each of these
displaying a map centered on London.

Work with a web map


An ArcGIS web map is a basemap and a related set of layers that users can interact with to
perform a meaningful task. These maps are available to a wide audience and include multiscale
basemaps, operational layers targeted to a specific audience, and information pop-up windows
that let users drill into specific features they are interested in. They are the basis of web mapping
applications and can be viewed on a wide variety of clients including web applications created
using the Flex API.
The Flex API makes it easy to add web maps into your web application. The web maps are
referenced via their item ID value. The ID is what you use to access and create your web map
within your Flex application. In order to determine the item ID of the web map, you will want to
view it using your portal's viewer, e.g. ArcGIS.com Viewer. After the web map loads, take note
of the browser's URL address. The last portion of the address is denoted by ...webmap=<unique
string value> as seen below.

In the screen capture above, the URL address for the web map is . The item ID is the web map
value, e.g. 2f1d4a31078d460aa4a7aa46f5b882e5.
Snippet showing how to add a web map to a Flex API application

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


protected function application_initializeHandler(event:FlexEvent):void
{
webMapUtil.createMapById("2f1d4a31078d460aa4a7aa46f5b882e5");
}

Additional references
Learn more about the web map format
Learn more about working with web maps
Tutorial: Adding a map with layers
Tutorial: Add a web map to the application

Using Extent
In this topic

Tutorial overview

Setting an extent

Setting an extent when using multiple services

Getting the current extent

Listening to extent changes

Version 3.7

Tutorial overview
Note:

The discussion in this topic assumes that you are familiar with the basic concepts of Flex.
This tutorial describes several ways to set the extent of the map as well as how to retrieve the
extent for use in other operations.
If you don't include extent information when you initialize a map, the default extent is used,
which is the extent of the map as it was last saved in the map document. If you use multiple
layers, or services, the default extent is the initial extent of the basemap or first layer added.

Setting an extent
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

To set an initial extent that is different from the default extent, use the extent property or Extent
class.
Using the extent property

To set the map extent using the extent property, perform the following steps:
1. Add your map.
2. Insert the <esri:Extent> tag and specify the ID and coordinates.
3. Add the <esri:ArcGISDynamicMapServiceLayer> tag.

Your code should look similar to the following:


<esri:SpatialReference id="wgs" wkid="4326"/>
<esri:Extent id="extentOfKansas" xmin="-103" ymin="36" xmax="-94" ymax="41"
spatialReference="{wgs}"/>
<esri:Map id="myMap" extent="{extentOfKansas}">
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/
ESRI_StreetMap_World_2D/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer
id="myLayer"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Petroleum/KGS_OilGasFields_Kansas/MapServer" />
</esri:Map>

Using the Extent class

To set the initial map extent using the Extent class, perform the following steps:
1.
2.
3.
4.

Add your map.


Add the <esri:SpatialReference> tag and specify the desired projection and well-known ID.
Insert the <esri:extent> tag and specify the ID and coordinates.
Add the <ArcGISTiledMapServiceLayer> tag.

Your code should look similar to the following:


<esri:SpatialReference id="wgs" wkid="4326"/>
<esri:Map id="myMap">
<esri:extent>
<esri:Extent xmin="-103" ymin="36" xmax="-94" ymax="41" spatialReference="{wgs}"/>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer
id="myLayer"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/M
apServer" />
</esri:Map>

Setting an extent when using multiple services


Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

In some cases, you may want to use the extent of a layer that is not the initial layer or basemap.
To do this, set the map extent to the extent of the desired layer. In the following example, two
layers are used: the base layer (ArcGIS Online world extent) and a second layer (the state of
Kansas).
To set Kansas as the extent, add a load property that sets the extent of the map:
load="myMap.extent = myKansasLayer.fullExtent"

The load property creates the map and, when loaded, sets the full extent to the Kansas layer.
The following code sets the map extent to myKansasLayer using fullExtent :
<esri:Map id="myMap">
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/
ESRI_StreetMap_World_2D/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer
load="myMap.extent = myKansasLayer.fullExtent"
id="myKansasLayer"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Petroleum/KGS_OilGasFields_Kansas/MapServer" />
</esri:Map>

Tip:

To set the initial extent instead of the full extent, use myKansasLayer.initialExtent .

Getting the current extent


Retrieve the current map extent using the extent property.

Listening to extent changes


The map will fire off an ExtentEvent every time the user pans or zooms the map. You can add an
event listener, using either MXML or ActionScript, to be notified of extent changes. See
the following example for additional help.

MXML example:

ActionScript example:

<esri:Map id="myMap" extentChange="displayExtent()">


<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/
ESRI_StreetMap_World_2D/MapServer" />
</esri:Map>
myMap.addEventListener
(ExtentEvent.EXTENT_CHANGE, extentChangeHandler);

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Time-aware layers
In this topic

Making layers time aware

Creating dates to use with time-aware layers

Working with time in the ArcGIS API for Flex

Samples

Version 3.7
ArcGIS 10 includes support for time-aware layers, which store information about the changing
state of a dataset over time. Time-aware layers allow you to step through periods of time
revealing patterns and trends in your data. For example, you can do the following:

Track hurricane paths and other meteorological events


Explore historic patterns in data through time (for example, population or land use changes)
Monitor changes in well production or status
Map the progression of a wildfire or flood
Visualize the spread of disease over time

The time extent of the map defines the time period for the data that is displayed by the timeaware layers. Setting the map's time extent is similar to setting the spatial extent, because once
the time extent is set, the map display updates automatically to conform to the change. Every
time the map's time extent is changed, all time-aware layers update to reflect the new time extent.
There are several ways to work with time-aware layers in a web API-based application. The
simplest is to use the TimeSlider component because it handles the process of updating the map's
time extent for you. You can also build applications that perform temporal queries, filter layers
using time definitions, and set the map's time extent.

Making layers time aware


You can make your layers time aware by using the Layer Properties dialog box in ArcMap
(right-click the layer in ArcMap and choose Properties to display the dialog box). Make sure
the Time Field is of type date. See the following screen shot:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Learn more about time properties


The time information is preserved and accessible through the map service when you publish your
map using ArcGIS Server. After publishing, you can work with a time-aware map or feature
service using the ArcGISDynamicMapServiceLayer or FeatureLayerclasses to perform temporal
queries and view changes in data over time.
Time-aware layers have a timeInfo property that provides access to the TimeInfo class. The
TimeInfo class provides detailed information about the layer's time properties including the time
range and time reference. The following snippet retrieves the time extent for a layer using the
timeInfo property:
var timeInfo:TimeInfo = myFeatureLayer.layerDetails.timeInfo;

Creating dates to use with time-aware layers

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

When working with time-aware layers, you may need to create dates to define a time extent. The
server assumes times sent in are in Coordinated Universal Time (UTC), so you should create
dates with that in mind. UTC is a time standard based on atomic time and is functionally
equivalent to Greenwich Mean Time (GMT).
// UTC
var decemberTimeExtent:TimeExtent = new TimeExtent
(new Date("2009/01/01 00:00:00 UTC"),new Date("2009/01/31 23:59:59 UTC"));
// Local Time
var decemberLocalTimeExtent:TimeExtent = new TimeExtent
(new Date("2009/01/01 00:00:00"),new Date("2009/01/31 23:59:59"));

Working with time in the ArcGIS API for Flex


The ArcGIS API for Flex provides a TimeSlider component that simplifies the process of
visualizing temporal data. Using the time slider, you can filter the map to display cumulative
data up to a point in time, a single point in time, or data that falls within a time range. The benefit
of using the time slider is that it handles setting the map's time extent, which filters time-aware
layers to only display data for the current time extent.
To set up the time slider, add a time-aware layer to the map using
theArcGISDynamicMapServiceLayer, ArcGISImageServiceLayer, or FeatureLayer class. Next,
associate the time slider with the map, then define the time slice to visualize the number of time
stops the slider should use:
protected function featurelayer1_loadHandler(event:LayerEvent):void
{
var ti:TimeInfo = FeatureLayer(event.layer).layerDetails.timeInfo;
myTimeSlider.createTimeStopsByTimeInterval(ti.timeExtent, ti.timeInterval,
ti.timeIntervalUnits);
}
...
<esri:Map timeSlider="{myTimeSlider}">
<esri:FeatureLayer
load="featurelayer1_loadHandler(event)"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/
Earthquakes/EarthquakesFromLastSevenDays/MapServer/0"/>
</esri:Map>
<esri:TimeSlider id="myTimeSlider" thumbCount="1"/>

Slider 'thumbs' denote a location on the slider. Possible values are '1' and '2'. The previous code
has the thumb count set to 1; this means that the map will display all features from the first time
to the current thumb position. To visualize a time range, set the thumb count to 2. To visualize
features for an instant in time, set the thumb count to 1 and set createTimeInstant=true .
Note:

It is not recommended to use the time slider with feature layers in on demand mode because this
can result in too many requests to the server. If you are not working with a large amount of data,

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

you can use a feature layer in snapshot mode. If your dataset is large, consider using an
ArcGISDynamicMapServiceLayer instead.
Filtering data using the map's timeExtent property

There are other ways besides the TimeSlider to visualize time-aware layers in your mapping
applications. The map has a timeExtent property that acts as a filter for layers that support time,
such as the ArcGISDynamicMapServiceLayer and FeatureLayer. Setting the map's time extent
fires the timeExtentChange event. Time-aware layers listen for this event and update themselves
to display content for the specified time extent. In the following example, only data that meets
the input time definition of December 31, 2010 appears:
var ti:TimeExtent = new TimeExtent();
ti.startTime = new Date("12/31/2010 UTC");
myMap.timeExtent = ti;

Filtering data using the layer's time definition using snapshot mode

Feature layers support the ability to set a time definition, which limits the data that is loaded in
the initial query. Setting a time definition on a layer is similar to setting a definition expression
and restricts the data to only features that match the input time extent. When you set a time
definition on a feature layer in snapshot mode, the features that match the time definition are
retrieved once the layer is loaded. If you modify the time definition after the layer is loaded, the
existing set of features is destroyed and a new request is made to retrieve the new set of features.
The current selection is always maintained and will not be destroyed if you set a new time
definition.
var myTimeDef:TimeExtent = new TimeExtent();
myTimeDef.startTime = new Date("2003/09/25 UTC");
myTimeDef.endTime = new Date("2005/10/25 UTC");
myFeatureLayer.timeDefinition = myTimeDef;

Querying data using a time extent

You can perform temporal queries against time-aware layers using the timeExtent property on
the Query object. For example, you might want to know all crimes that occurred during the night
shift from 10 p.m. to 6 a.m. on a particular date:
var ti:TimeExtent = new TimeExtent();
ti.startTime = new Date("06/13/2012 22:00:00");
ti.endTime = new Date("06/14/2012 06:00:00");
var myQuery:Query = new Query();
myQuery.timeExtent = ti;
myFeatureLayer.queryFeatures(myQuery);

Samples
The ArcGIS API for Flex has several samples that show how to work with time-aware layers
including the following:

TimeSlider (feature layer)TimeSlider and createTimeStopsByTimeInterval()


TimeSlider (dynamic service)CreateTimeStopsByCount()

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Filtering by timeTwo thumbs and createTimeStopsByCount()


Time rendered earthquakesTimeSlider and createTimeStopsByTimeInterval()
Time-aware Image serviceTimeSlider and createTimeStopsByTimeInterval()
Timeslider and skin partsTimeSlider, two thumbs, and createTimeStopsByTimeInterval()

Layers overview
In this topic

Layers in the ArcGIS API for Flex

Version 3.7

Layers in the ArcGIS API for Flex


There are various types of layers to work from when developing in the ArcGIS API for
Flex. Layers is a term used in the API reference that can be seen analogous to services. Which
type of layer (service) you choose depends on the type of functionality needed.
Note:

All layers derive from the Layer base class.


Types of Layers (Services) in the ArcGIS API for Flex

ArcGISTiledMapServiceLayer
OpenStreetMapLayer
WMTSLayer
VETiledLayer
ArcGISLocalTiledLayer
WebTiledLayer
ArcGISDynamicMapServiceLayer
ArcGISImageServiceLayer
GPResultImageLayer
WMSLayer
ArcIMSMapServiceLayer
GraphicsLayer
FeatureLayer
CSVLayer
GeoRSSLayer
KMLLayer
MapImageLayer

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Basemap layers
In this topic

Basemap layers in the Flex API

Additional Resources

Version 3.7

Basemap layers in the Flex API


Basemaps are usually pregenerated maps that are commonly referred to as cached or tiled layers.
In the ArcGIS API for Flex, the layers below inherit directly fromTileMapServiceLayer, which
in turn, extends the Layer class. There are various types of basemaps as listed below.

ArcGISTiledMapServiceLayer
OpenStreetMapLayer
WMTSLayer
VETiledLayer
ArcGISLocalTiledLayer
Note:

The ArcGISLocalTiledLayer is designed specifically for mobile applications and is only


supported in Adobe AIR applications.

WebTiledLayer, this provides a mechanism to add non-ArcGIS map tiles as a layer to a


map
Custom layers that extend the TiledMapServiceLayer class

Basemaps tend to be relatively static and are typically updated on an infrequent basis. Generally,
you use basemap layers as the framework for which you display dynamic operational and/or
graphics layers. For more information regarding working with basemaps, see Working with
basemap layers
Note:

Of the basemap layer types listed above, the ArcGISTiledMapServiceLayer andWMTSLayer classes
use a cached map service hosted from ArcGIS for Server.

Additional Resources

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Please refer to the various samples illustrating how to use these various types of layers. You can
download these samples from GitHub.

Operational layers
In this topic

Operational layers in the Flex API

Version 3.7

Operational layers in the Flex API


Operational layers focus primarily on dynamic data. In other words, data that can change more
frequently than that of a cached basemap. Many times these layers encapsulate related content,
such as earthquake, weather, and traffic data. Operational layers can be differentiated a couple of
different ways, either as server-side image results or, client-side graphics.
Server-side image results

ArcGIS for Server hosts both cached and dynamic data. The operational layers, or dynamic
layers, inherit directly from the DynamicMapServiceLayer class, which in turn, extends
the Layer class. These types are:

ArcGISDynamicMapServiceLayer
ArcGISImageServiceLayer, for more information, see Key concepts for Image Services
GPResultImageLayer
WMSLayer, for more information, see WMS Services
ArcIMSMapServiceLayer

Client-side graphics

Client-side graphics allows information to be displayed more efficiently on the client machine.
This is typically done in use cases that involve graphics as user input for markup or a task, or the
graphics can be drawn as an output response from a task. The client-side graphics layer types
include:

GraphicsLayer, for more information regarding working with graphics and the GraphicsLayer ,
see Using Graphics
FeatureLayer, this layer extends GraphicsLayer . For more information regarding working with
feature layers, see Feature Layer
CSVLayer, this layer extends FeatureLayer. For more information regarding working with
the CSVLayer , see CSVLayer
GeoRSSLayer, this layer extends directly from the Layer class and is used to create a layer based
on GeoRSS. GeoRSS is a way to add geographic information to an RSS feed

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

KMLLayer, this layer extends directly from the Layer class and is used to create a layer based on
publicly accessible KML or KMZ files. For more information regarding working with KML data,
please see KML support in ArcGIS Server.

In addition to the layer types listed above, there is an additional MapImageLayer type. This
directly inherits off of Layer and is used to add georeferenced images to the map. It is used to
work with dynamically generated Map Image objects. A MapImage is accessed a couple of
different ways:

GroundOverlays - come back as part of KML. Every ground overlay is treated as a map image
where MapImage.source is the URL to the image.
Geoprocessing operations - The export operation on ArcGISDynamicMapServiceLayer returns
a MapImage in addition to GeoProcessor.getResultImage .

Using Graphics
In this topic

Graphics in the ArcGIS API for Flex

Version 3.7

Graphics in the ArcGIS API for Flex


Note:

The following discussion assumes that you are familiar with the basic concepts of Flex.
Working with graphics

When the ArcGIS API for Flex was first released, the only option for displaying information
client-side was through the use of a graphics layer. The graphics layer allows you to dynamically
display graphics on a map. The graphics can be drawn by the user as markup or input to a task,
or they can be drawn by the application in response to a task. For example, the application might
add the results of a query to the map as graphics.
A graphic is composed of the following:

Geometry The geometry determines where the graphic is located. IT can be point, multipoint,
polyline, polygon, or extent.
Symbol The symbol determines how the graphic looks. It can be a marker symbol (for point
and multipoint geometries), a line symbol (for polylines), or a fill symbol (for polygons). For
more information on working with symbols in graphics, see Symbols and Renderers.
Attributes These are name-value pairs that describe the graphic. If you create the graphic,
you need to assign the attributes. If the graphic is created in response to a task performed on a

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


layer, the graphic automatically includes the field attributes of the layer. Some tasks allow you
to limit the attributes that are returned to the resultant graphic. Query.outFields is an example
of a property that limits the returned attributes of a task.

Graphics are not required to have all of three items as listed above. For example, many task
results are returned as graphic objects in a FeatureSet. These graphics have only geometry and
attributes when they are returned. If you want to add the graphics to a map, you must define a
symbol for them.
If you're writing code that allows users to draw graphics on the map, the Draw tool can make
your work easier. DrawTool is a class that can help you capture the geometry that a user draws
on the screen. You can then define a symbol and apply it to the geometry in a new graphic
object. The DrawTool sample demonstrates this workflow.
The way that you add task results to the map as graphics varies by task type. If your task returns
a feature set, you get an array of graphics (FeatureSet.features) that you can assign to
graphicProvider of GraphicsLayer. The code below shows how you might do this with results
from QueryTask.
This code defines a symbol to the graphics layer that is assigned to all the graphics added to that
layer.
private function doQuery():void
{
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
myGraphicsLayer.graphicProvider = featureSet.features;
}
function onFault(info:Object, token:Object = null):void
{
Alert.show( info.toString() );
}
}
<esri:SimpleMarkerSymbol id="sms" size="10" color="0xFF0000" style="circle" />
<esri:GraphicsLayer id="myGraphicsLayer" symbol="{sms}"/>

Other tasks do not provide a feature set as a result but do provide the geometry, which you can
use to create a graphic. For example, a Locator task finds an address candidate, whose location
property is a MapPoint geometry. You can use this geometry to create a graphic showing the
address location, as in the code below:
for each (var candidate:AddressCandidate in candidates)
{
if (candidate.score > 80) {
var myGraphic:Graphic = new Graphic();
myGraphic.geometry = candidate.location;
myGraphic.symbol = mySymbol;
myGraphic.attributes = { address: candidate.address,score: candidate.score, locatorName:
candidate.attributes.Loc_name };
myGraphicsLayer.add(myGraphic);
}
}

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

See the samples for more ideas of how to create graphics from the results of different tasks.
3.0 and above

Starting with version 3.0 of the ArcGIS API for Flex, a defaultGraphicsLayer property was
added to the Map class. This references the default graphics layer that is always displayed on top
of all other layers in the map. This graphics layer cannot be removed.
Extending the graphics layer

The graphics layer is a very useful class that provides vast functionality. You can add to the
already existing functionality provided by the graphics layer by extending it to build your own
custom graphics layer. One example as to why you may want to create an extendable version of
the graphics layer would be if you have attribute information that should correspond to a specific
level of geography, e.g. census data in relation to county polygons. A custom graphics layer
could be created that uses the geometry from an ArcGIS for Server service and corresponding
attribute information could be derived from another back-end service, combining them to create
graphic objects within a custom graphics layer. The FeatureLayer class was introduced at version
2.0 of the ArcGIS API for Flex and is a prime example of extending the GraphisLayer class.
Conceptual overview of working with Graphics
The following provides high-level steps of working with graphics in the API:

1.
2.
3.
4.
5.

Retrieve the graphics layer.


Create or retrieve a graphic.
Set the graphic's Geometry (if it is not already set).
Apply the symbol to the graphic.
Add the graphic to the graphics layer.

Feature layer
In this topic

How do I create a feature layer?

What can I do with a feature layer?

Samples

Version 3.7
Feature layers are used to display features from one single layer of either a
feature or map service. The layer can be either a spatial layer or non-spatial
table. The ArcGIS API for Flex version 2.0 and above offers a FeatureLayer for
working with client-side graphic features. You may be familiar with

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

the GraphicsLayer from previous releases. The feature layer inherits from the
graphics layer and offers additional capabilities such as the ability to perform
queries and selections. Feature layers are also used for web editing if based on a
layer in a feature service.
Feature layers differ from tiled and dynamic map service layers because they
bring geometry information across to the client computer to be drawn by the
client. Feature layers potentially cut down on round-trips to the server. A client
can request the features it needs, then perform selections and queries on those
features without having to request more information from the server. Feature
layers are especially appropriate for layers that respond to user interaction, such
as a mouse click or hover.
A feature layer honors any definition queries, scale dependencies, and other
properties configured on the layer in the map service. Using a feature layer, you
can access related tables, perform queries, display periods of time, and work
with feature attachments.

How do I create a feature layer?


A feature layer references a single layer from either a map service or a feature service. The
feature service is required for editing, but both will honor any feature templates configured in the
source map document as long as you connect to an ArcGIS 10.0 service or higher. For earlier
versions of ArcGIS for Server, no symbology can be retrieved from the server, but you can still
use it with a feature layer.
Choosing the display mode

When you create a feature service, you also need to specify one of these modes for retrieving
features:

On demand mode (the default) retrieves features as they are needed, requesting only the
features within your current view extent. On demand mode potentially requires more round
trips between the client and server. However, it protects you from retrieving more features than
you need.
Snapshot mode retrieves all the features from the layer immediately after the layer is added to
the map. This reduces subsequent traffic to the server, but can become cumbersome if the layer
contains many features. The browser may be overwhelmed by the number of features it needs
to draw, or the service may reach its limit of how many features it can return at once. The
default is 500 for ArcGIS 9.3.1 and 1,000 for ArcGIS 10.x.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Tip:

Use snapshot mode primarily with smaller datasets or with temporal data.

Selection mode does not initially request any features. Features are added only when a selection
is made. This mode is useful when you cannot or do not want to bring all features into the client,
but you want to highlight one or more features for a certain reason, for example, editing,
querying, or accessing related tables. Selections are drawn using a client-side selection color
that you specify on the feature layer.

Two common examples for using Selection mode:

Query: you can use a dynamic service for your general map representation, but when doing an
identify or query you want to highlight the selected features.
Editing: only the selected feature will be highlighted on the map within the feature layer.
Once editing is complete, the selection is removed from the feature layer and the user can
update the dynamic map service layer to see the updated feature.

Tip:

No matter which of the display modes you choose for your feature layer, selected features are
always held on the client. For example, if you are using the on demand display mode and you
have selected some features, panning away from those selected features will still result in the
features being available on the client. Your application will not have to reselect the features or
make any other request to the server if you pan back to the original area. For this reason, it is a
good practice to clear your selected features once they are no longer needed.
Choosing the attributes you need

Feature layers retrieve both feature geometries and attribute information. When you create the
feature layer, you can set the outFields property to specify which attributes will be retrieved for
your features. It is possible to use the asterisk (*) to get all the fields, but to reduce the amount of
information sent between the client and server, you should request only the fields you need in
your application. If you later perform a query using the feature layer, the query will honor the
outfields you set.

What can I do with a feature layer?


Feature layers make it possible for you to do all of the following:
Editing

Feature layers are the key to editing features with the web APIs. The editing components
included in the APIs are designed to work with feature layers. You can only perform editing on
feature layers that reference an editable layer within a feature service. See Editing to learn more
about this requirement and how to create a feature service.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Definition expressions

There may be times where you want to work with features that satisfy certain attribute criteria
and disregard the rest. In this type of situation, you can set a definition expression on the feature
layer to retrieve just the features you need. Every feature layer has
a definitionExpression property, which comes from the definition query set in the source map
document.
Time

When using a feature layer in snapshot mode, you can retrieve features that meet a certain
temporal criteria using the timeDefinition property on the feature layer. This property
temporarilty defines the features in the layer to match a specified TimeExtent. This option is only
available with features loaded in snapshot mode. For example, you might want to only load
houses that were built before 1930. You would set the feature layer's timeDefinition to a
TimeExtent prior to 1930.
Note:

This option is only available with features loaded in snapshot mode.


You can track and render observations using a feature layer as well.
TheTemporalRenderer renderer can highlight the latest observation and render a group of
individual features within a feature layer. This renderer uses the time field set on the feature
layer. See Symbols and Renderers for additional discussion on temporal renderers.
The feature layer also has a FeatureCollection property. This property is used when you want to
initialize the feature layer with a collection of features originating outside of ArcGIS Server. See
the sample Time Rendered 5k run (gpx) which uses the feature layer's property to pass in GPX
data to a feature layer.
Selection and display

The feature layer supports a selection, which represents a subset of features that the user has
chosen to isolate for viewing, editing, or analytical purposes. Users can add or remove features
from the selection based on spatial or attribute criteria. The feature layer makes it easy to draw
the selection set with a different type of symbol than the other features. If you don't specify the
symbol, a default symbol will be applied. This was previously challenging to do without using
two graphics layers.
A selection set can be used as input for statistical calculations, geoprocessing tools, and
graphing. Therefore, opening the possibility for interactive GIS analysis and exploration. For
example, users can draw a polygon to select a set of buildings, then push a button to calculate the
solar potential of those buildings. Selections also play an important role in some editing
workflows where the feature currently undergoing edits is highlighted.
To make your selection, use the selectFeatures method on feature layer which takes a query
object as an argument. If you are interested in querying your feature layer without adding the
results to the selection set, you can use either queryFeatures orqueryRelatedFeatures instead.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

With any of these methods, you cannot request features outside of any definition expressions set
in the map document or on the feature layer.

Samples
The ArcGIS API for Flex has several samples that show how to work with feature layers. Here
are a few you may find useful:

Based on MapServer layer using default mode (on demand)


FeatureLayer ToolTips using snapshot mode
Search with FeatureLayer using definitionExpression and snapshot mode
InfoWindows for FeatureLayer using definitionExpression and default mode (on demand)
InfoWindow on Click using on demand mode
InfoWindow on MouseOver using snapshot mode, definitionExpression, and graphicAdd
Related records using selectFeatures() and selection mode
Multiple related records using queryRelatedFeatures() and selection mode
Clustering using clusterer, definitionExpression, and graphicAdd
Time rendered 5K run using FeatureCollection

AttributeTable
In this topic

Working with the AttributeTable

Conceptual workflow

Additional references

Version 3.7
The AttributeTable component displays a tabular view of a feature layer's
attributes. If the feature layer is editable, you can edit the records within the table
widget as well. It recognizes layers added specifically as feature layers, whether
it be from a Feature Service or Dynamic Map Service. In addition to feature
layers that are directly added, it will also recognize any layers within a full
dynamic map service as well and display features within the extent.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Working with the AttributeTable


Once the web application loads, the AttributeTable component checks for any feature layer
feature(s) in the current extent and populates the attribute table with its feature(s). Aside from
providing a tabular display of the layer's data, the feature's can be selected, deselected, and
zoomed-to by interacting with the attribute table. If these feature layers are editable, the
corresponding feature attributes will also be editable. In addition, the fields can be sorted by
clicking on its heading.
The attribute table also has a Table Options dropdown combobox that allows you to choose
different functions such as:

Export the attributes to a CSV fileExports the attributes to a separate CSV file.
Note:

If records are selected, only the selected features are written to this file. If working with
point feature classes, two additional fields are also written into this CSV file indicating
latitude and longitude. This specific feature with points is only supported for Web
Mercator and Geographic spatial references.

Zoom to selected featuresZooms to the extent of the selected features.


Clear SelectionClears the current selection.
Delete selected features If editable, deletes the selected features.
Note:

This option is only enabled if the feature layer is editable.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Show attachmentsThis option is available if the feature layer has attachments enabled on it.
Show related recordsThis option is available if the feature layer has any associated
relationships.

Note:

If a Uniform Resource Locator (URL) exists as a field value in your service it will display as a
text string in the attribute table and not as a hyperlink.
If you are outside an extent and are not displaying any visible features, a message will appear
displaying "No features in current map extent". Also, if your scale is out of the visible range of
the layer, you will receive a message stating "Layer is out of scale range".

Conceptual workflow
Requires: Feature layers from either a dynamic map service or feature service.

Reads feature layers and populates the contents of the widget with the corresponding feature's
records within the current map extent. If more than one layer, multiple tabs will display in the
table.
Attribute table updates as feature(s) updates change with extent changes.
Interactive functionality between records and features in the map.
Edits can be performed on the records if the layer is editable.

Additional references
To test out this functionality, see the AttributeTable sample.

Symbols and Renderers


In this topic

Symbols

Renderers

Version 3.7

Symbols
Symbols define the non-geographic aspects of a graphic's appearance, including color, border
width, transparency, and so on. The ArcGIS API for Flex includes many symbol classes, each of

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

which allows you to specify symbology in a unique way. Each symbol type is also specific to
one geometry type (that is, point, line, or polygon).
The following table lists the different types of symbols available with the ArcGIS API for Flex.
Type

Description

PictureMarkerSymbol
Symbolizes points with images
SimpleMarkerSymbol
Symbolizes points with simple shapes
SimpleLineSymbol andCartographicLineSymbol Symbolizes lines with pre-defined styles
SimpleFillSymbol
Symbolizes polygons with a specified fill style
PictureFillSymbol
Symbolizes polygons with an image
TextSymbol
Symbolizes text at points on a graphics layer
CompositeSymbol
Symbolizes multiple symbols on a single graphic
Symbolizes point data with small window showing UI
InfoSymbol
control and data. For more information, see the
topic InfoSymbol and InfoRenderer.
The symbol of a graphic can be determined in the following ways:

As the graphic's defined symbol.


As a renderer defined in the layer.
As a symbol defined in the layer.
As a symbol directly on the graphics layer. This works as the default for graphics that do not
have a specific symbol or renderer.

Renderers
A renderer defines a set of symbols that will be used for graphics in a graphics layer. You can
use renderers to symbolize features with different colors or sizes based on a particular field
attribute.
There are four types of renderers provided with the ArcGIS API for Flex. All of these renderer
classes reside in the com.esri.ags.renderers package.
Simple Renderer
Class Breaks Renderer
Unique Value Renderer
Temporal Renderer
Tip:

While it is possible to have different geometries (for example, points and lines in the same
graphics layer), renderers work best when the layer has only one type of geometry.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Simple renderer

A simple renderer uses the same symbol for every graphic. All you do is specify the symbol to
be used by the renderer, then apply the renderer to the graphics layer. This is equivalent to
setting the symbol on the graphics layer.
<esri:GraphicsLayer id="graphicsLayer">
<esri:renderer>
<esri:SimpleRenderer symbol="{smallSym}"/>
</esri:renderer>
</esri:GraphicsLayer>

or
<esri:GraphicsLayer id="graphicsLayer" symbol="{smallSym}"/>

Class breaks renderer

A class breaks renderer symbolizes each graphic based on the value of one of its fields. Graphics
with field values inside the class break (a.k.a. range) will all use the same symbol. The breaks
define the values at which the symbology changes. For example, suppose you have a 'buildings'
layer with a field that defines the building's age. You want to symbolize buildings constructed
since the year 2000 in green, buildings constructed between 1980 and 2000 in yellow, and
buildings built before 1980 with red. This would be a good scenario for a class breaks renderer.
To use a class breaks renderer, you simply add one or more breaks. Each break specifies the
symbol to use and the minimum and maximum values that will be used for that symbol. The
following code example shows how you can explicitly define the breaks.
var smallSym:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,6,
0xFF0000, 0.7);
var mediumSym:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10,
0xFF0000, 0.7);
var largeSym:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,16,
0xFF0000, 0.7);
var classBreaksRenderer:ClassBreaksRenderer = new ClassBreaksRenderer();
classBreaksRenderer.field = "BUILD_DATE";
var classBreakInfos:Array = [
new ClassBreakInfo(smallSym, Number.NEGATIVE_INFINITY, 1980),
new ClassBreakInfo(mediumSym, 1980, 2000),
new ClassBreakInfo(largeSym, 2000, Number.POSITIVE_INFINITY)
];
classBreaksRenderer.infos = classBreakInfos;
graphicsLayer.renderer = classBreaksRenderer;

Note:

If there is no maximum limit on a break, you can use "Number.POSITIVE_INFINITY for the
maximum value. Similarly, you can use Number.NEGATIVE_INFINITY when there is no minimum.
Any value that is greater than or equal to the minimum will be included in the break. Any value
that is less than the maximum will be included in the break. Consequently, if you have two
breaks, 010 and 1020, the value 10 would fall in the second break (1020). Avoid creating
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

overlapping breaks or gaps between breaks. You can also define breaks mathematically. For
example, you can do some basic arithmetic to ensure that each break falls an equal distance apart
given the input data (sometimes known as an equal interval classification).
var numRanges : int = 10;
var breaks:Number = (max - min) / numRanges;
for (var i:int = 0; i < numRanges; i++)
{
classBreakInfos.push(new ClassBreakInfo(
new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, (i+1)*5, 0xFF0000, 0.7),
min + (i*breaks),
min + ((i+1)*breaks)
)
);
}

Unique value renderer

A unique value renderer symbolizes groups of graphics that have matching fields. For example,
you can use a unique value renderer to symbolize zoning designations: red for Residential, green
for Industrial, blue for Commercial, and so on. To define a unique value renderer, you specify
the field on which to base it, and an optional defaultSymbol for values that are not covered by a
specific UniqueValueInfo. Each UniqueValueInfo contains the specific value and symbol to use
for each unique value.
<esri:SimpleFillSymbol id="rFill" alpha="0.5" color="0xFF0000"/>
<esri:SimpleFillSymbol id="gFill" alpha="0.5" color="0x00FF00"/>
<esri:SimpleFillSymbol id="bFill" alpha="0.5" color="0x0000FF"/>
<esri:UniqueValueRenderer id="uniqueValueRenderer" field="ZONING">
<esri:UniqueValueInfo value="Residential" symbol="{rFill}"/>
<esri:UniqueValueInfo value="Industrial" symbol="{gFill}"/>
<esri:UniqueValueInfo value="Commercial" symbol="{bFill}"/>
</esri:UniqueValueRenderer>

The equivalent code with ActionScript:


var rFill:SimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 0xFF0000, 0.5);
var gFill:SimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 0x00FF00, 0.5);
var bFill:SimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 0x0000FF, 0.5);
var uniqueValuerenderer:UniqueValueRenderer = new UniqueValueRenderer();
uniqueValuerenderer.field = "ZONING";
var uniqueValueInfos:Array =[];
uniqueValueInfos.push(new UniqueValueInfo(rFill, "Residential"));
uniqueValueInfos.push(new UniqueValueInfo(gFill, "Industrial"));
uniqueValueInfos.push(new UniqueValueInfo(bFill, "Commercial"));
uniqueValuerenderer.infos = uniqueValueInfos;
graphicsLayer.renderer = uniqueValuerenderer;

Values that aren't added to the list are not drawn unless you specify a defaultSymbol on the
UniqueValueRenderer, in which case those graphics are drawn with the default symbol.
Temporal renderer
Note:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

This section specifically discusses temporal rendering. For more information regarding working
with time data, see Time-aware layers.
A temporal renderer is a custom renderer where the symbology of a FeatureLayer is displayed
based upon the featurelayer's time field. Temporal renderers are useful when visualizing historic
or real-time data such as hurricanes or earthquake occurrences.
The observationRenderer property provides a default set of symbology for features in a timebased layer. This default symbology can be overridden by thelatestObservationRenderer and
the trackRenderer to provide additional ways to graphically represent the features that are
returned from a featurelayer. While it is theoretically possible to have any renderer that
implements the IRenderer interface be used as the observationRenderer property, it typically
makes sense to only use a SimpleRenderer, ClassBreaksRenderer, or UniqueValueRenderer.
The latestObservationRenderer property provides a default set of symbology for the last timebased feature returned per the featurelayer's time field. If no time field has been specified than
just the last observation that is returned from the featurelayer will be symbolized. Whatever
symbology properties that have been set (for example: a symbols color, size, and style) for
the latestObservationRenderer will override what was set for the observationRenderer. While it
is theoretically possible to have any renderer that implements the IRenderer interface be used as
the latestObservationRendererproperty, it typically makes sense to only use a SimpleRenderer,
ClassBreaksRenderer, or UniqueValueRenderer.
The trackRenderer property provides polyline based symbology that connects markers (i.e.
points) for time-based features per the feature layer's time field. If no time field has been
specified than all observations that are returned from the feature layer will be symbolized in
sequential order using the polyline graphic. The polyline graphic that is drawn begins with the
first temporal observation and connects-the-dots as the phenomena moves spatially through time.
The observationAger property is an optional technique to modify a symbols size, color, and
opacity for the renderers applied to the TemporalRenderer as a features time stamp adjusts. Two
observationAgers are supported: the TimeRampAger andTimeClassBreaksAger.
The TimeRampAger will modify the rendering of entire set of features and graduate the
symbology based upon the set properties (except for thelatestObservationRenderer).
The TimeClassBreaksAger will modify the rendering of a specific set of defined groups based
upon a range of values. If a specific group has not been defined by
the TimeClassBreaksAger than the observationRenderer will take precedence; additionally
the latestObservationRenderer takes precedence if set.
To see a working sample that uses a temporal renderer with a TimeRampAger,
seeTime_rendered_5K_run_(gpx).

InfoSymbol and InfoRenderer


In this topic

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Working with InfoSymbols

Limitations

Version 3.7

Working with InfoSymbols


InfoSymbols are small windows containing user interface (UI) controls and data that provide
information about a point feature on a map. Unlike InfoWindows, multiple InfoSymbols can be
displayed on a map at one time.
InfoSymbol has two properties, infoPlacement and infoRenderer. The infoPlacement property
determines the orientation of the symbol. Refer to the InfoPlacement class for the list of possible
values.
The infoRenderer property is of type IFactory and can be defined as either inline or external. The
infoRenderer contains the definition of UI controls to add to the InfoSymbol and the data that
determines its appearance. Once the InfoSymbol has been created, it can be assigned as a graphic
symbol, similar to a MarkerSymbol.
Defining inline infoRenderer

You can define infoRenderer as inline (in other words, defined in the same file as InfoSymbol).
To define an inline infoRenderer, do the following:
1. Insert InfoSymbol and infoRenderer tags.
2. Define UI controls within the <fx:Component> tag. These will be the contents of InfoSymbol .
3. If necessary, use outerDocument to include variables and methods outside <fx:Component> .
<esri:InfoSymbol id="infoSymbol1">
<esri:infoRenderer>
<fx:Component>
<mx:VBox>
<mx:Panel id="myPanel" height="100%"
width="100%" backgroundAlpha="0"
initialize="{outerDocument.initPanel(event)}"/>
<mx:Button id="myButton" height="100%"
width="100%"
click="{outerDocument.showResults()}"/>
</mx:VBox>
</fx:Component>
</esri:infoRenderer>
</esri:InfoSymbol>

Defining external infoRenderer

Defined in a separate file from InfoSymbol, external infoRenderers are preferred because of their
modular, reusable design. The external infoRenderer is defined by taking all the content that

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

would be contained between the <fx:Component> tags and placing it in a discrete MXML or
ActionScript file. An example of an infoRenderer in a separate MXML file called
MyInfoRenderer.mxml will look like below:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:fx="http://ns.adobe.com/mxml/2009"
backgroundColor="0xEEEEEE"
label="{data.STATE_NAME}"
>
<mx:Label text="State Fips: {data.STATE_FIPS}"/>
<mx:Label text="Abbreviation: {data.STATE_ABBR}"/>
<mx:Label text="Area: {data.AREA}"/>
</mx:VBox>

Once defined, the infoRenderer can be used by any InfoSymbol in ActionScript or MXML. To
set the infoRenderer in ActionScript, construct your code similarly to the following:
var mySymbol:InfoSymbol = new InfoSymbol();
mySymbol.infoRenderer = new ClassFactory(MyInfoRenderer);
myGraphic.symbol = mySymbol;

To set the infoRenderer in MXML, construct your code similarly to the following:
<esri:InfoSymbol id="infoSymbol1" infoRenderer="MyInfoRenderer"/>

Limitations
InfoSymbol can only be assigned to points. To add InfoSymbols to multipoints, convert them to
points. To add InfoSymbols to lines or polygons, you can find a label point of the line or polygon
and either change the graphic's geometry to center point or create a new point graphic at the
location of the center point.
For example:
var polygon: Polygon;
var centerPt: MapPoint;
polygon = myGraphic.geometry as Polygon;
centerPt = polygon.extent.center;
myGraphic.geometry = centerPt;

Dynamic workflows overview


In this topic

Overview of dynamic workflows

Additional Resources

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Version 3.7

Overview of dynamic workflows


Starting with ArcGIS 10.1, you now have the ability to alter an ArcGIS Server dynamic map
service during the request and change it dynamically. Before this, it was possible to control what
data was displayed through filtering and querying data, e.g. such as a turning on/off layers or
changing the layer's definition expression. Now with the use of dynamic layers you can control
which layers will appear in a map, layer symbology, layer order and position, labeling, and more,
all through the use of server-side capabilities.
Dynamic layers

Dynamic layers allow clients to change layer appearance and behavior on-the-fly in a map
service. A dynamic layer / table resource represents a single layer / table of a map service
published by ArcGIS Server or of a registered dynamic workspace. Dynamic layers supports
adding feature layers and raster layers from the following data sources:

Enterprise geodatabase
File geodatabase
Shapefile
File-based raster
Query layers - from and ArcSDE enterprise geodatabase or non-SDE enterprise database.

If you are uncertain whether your dynamic map service supports dynamic layers, you can check
its metadata directly in the REST services directory. There is a parameter called Supported
Dynamic Layers and will report as either true or false depending on how the service was
initially configured.
Besides manually checking the REST services directory to verify if it supports this functionality,
the ArcGISDynamicMapServiceLayer's supportsDynamicLayers property also indicates whether
this functionality has been set.
See Enabling dynamic layers on a map service in ArcGIS Desktop and Enabling dynamic layers
on a map service in Manager for additional information on this setting.
Common dynamic workflow scenarios

The following describes some common reasons you may want to dynamically alter your map
service:

Define whether labels will appear for a layer. See the samples, LabelOptionsWizard,Dynamic
labeling, and Dynamic labeling (advanced).
Define layer symbology. See the samples, Change LayerDrawingOptions, Generate
renderers, RangeValueRenderer, and UniqueValueRenderer.
Define how layers are rendered (simple, unique value, or class breaks). See the samples, Change
LayerDrawingOptions, Generate renderers, RangeValueRenderer, and UniqueValueRenderer.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Define the position and order of layers in the map service. See the sample, Change Layer
Ordering.
Add new layers to the service from a registered workspace. See the sample, Dynamic
workspace.
Modify and/or add joins to an existing or new layer/table. See the sample,DynamicLayerInfo
JoinDataSource.

Additional Resources
Please see Dynamic Workspaces and Dynamic Rendering for additional information regarding
dynamically altering map services.

Dynamic Workspaces
In this topic

Dynamic workspaces

Additional Resources

Version 3.7

Dynamic workspaces
If you want to dynamically add data to your map service, such as feature classes, shapefiles,
rasters, or feature attribute tables, you will need to set up a workspace to contain the data you
want to add. Dynamic workspaces can be any enterprise geodatabase, file geodatabase, or file
directory on disk that is accessible to the server. If your dynamic workspace is an enterprise
geodatabase, you have the option of limiting user access to the geodatabase by locking the
database version.
Let's discuss why the ability to dynamically add data to a map service is so useful. First consider
that, for performance reasons, it is generally good practice to keep the number of layers in a
dynamic map service to a minimum. With this said, there may be circumstances when a use-case
may warrant the ability to work with multiple layers in a map service. This would be a good
opportunity to take advantage of dynamic workspaces and their ability to add data to the map
service on-the-fly.
For example, consider you have a service with basic layers such as states, provinces, counties,
rivers, and/or cities. These are used as template base layers for your service. You may have
requirements that call for adding potentially hundreds of various layers to the template base
layers. Prior to ArcGIS 10.1, you would have had to put all of these layers in the source
document that was used to create the service. Now all you need to do is make certain that the
service allows dynamic capability with per-request modification of layer order and symbology.
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

You can then add data, as in the above example where the 'hundreds of layers', would reside in
this registered workspace. When you add a dynamic workspace, you provide the workspace type,
id, and location. Once you have configured these settings, you then have the capability to add
data from the registered location to your map service dynamically. See the ArcGIS Help for
more information on how to do configure these settings.
Dynamically adding layers at runtime

The Dynamic workspace sample illustrates how to dynamically add a layer at runtime. This
sample uses the ArcGISDynamicMapServiceLayer's layerDrawingOptions property in addition
to its createDynamicLayerInfosFromLayerInfos method. This method returns an array
of DynamicLayerInfo instances. The sample gets the dynamic layer info array from the dynamic
map service, it then writes back to this array with a new DynamicLayerInfo object. After this, the
layerDrawingOptions property is written to that of a new layerDrawingOptions instance.
Snippet taken from Dynamic workspace sample
{
var dynamicLayerInfos:Array = usaLayer.createDynamicLayerInfosFromLayerInfos();
dynamicLayerInfos.unshift(lakesDynamicLayerInfo);
usaLayer.dynamicLayerInfos = dynamicLayerInfos;
usaLayer.layerDrawingOptions = [ lakesLayerDrawingOptions ];
}

The DynamicLayerInfo's source property is set to an instance of a LayerDataSource. The


LayerDataSource's dataSource property is set to an instance of a TableDataSource. This
TableDataSource contains all of the dynamic workspace information. ThedataSourceName is the
name of the layer to be added. The workspaceId is the unique workspace identifier that was
configured when enabling the dynamic workspace.
Note:

You must know the name of the layers you are adding. In addition, the ArcGIS Server account
must have at least read access to the dynamic workspace that contains the data you wish to
dynamically add to the map service.

Additional Resources
Dynamic workspaces are enabled outside of the web APIs using ArcGIS for Desktop or
Manager. More information on setting the map service properties can be found atSetting map
service properties. See Making your data accessible to ArcGIS Server for additional information
regarding setting permissions on these workspaces.

Dynamic Rendering
In this topic

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Dynamic symbology

Dynamic labeling

Change layer order

Additional Resources

Version 3.7
This topic discusses various ways of dynamically altering the rendering of map service layers.
These options include: updating symbology, labeling features, and changing layer order
dynamically.

Dynamic symbology
The following provides a couple of different options to consider when dynamically symbolizing
your data:
Taking existing renderers and applying to server-side features

Prior to ArcGIS 10.1 and the 3.x version of the Flex API, you would have sent the features from
a service client-side using either a GraphicsLayer or a FeatureLayer and then possibly
symbolized them based on a given renderer. Now, you can take advantage of dynamic
symbology by using this existing 'legacy' code that created these renderers and instead of
applying them client-side to either the GraphicsLayer or FeatureLayer, you can now apply the
renderers to the map service features.
How do you apply existing renderers to server-side features?

The main difference is that the renderer is now applied using the LayerDrawingOptionsproperty
of the dynamic map service layer instead of applying it to the GraphicsLayer or FeatureLayer.
Both samples, RangeValueRenderer and UniqueValueRenderer, show this behavior.
Small snippet taken from RangeValueRenderer sample.
<!--SimpleFillSymbol {SFS} set client-side...-->
<esri:layerDrawingOptions>
<esri:LayerDrawingOptions layerId="2">
<esri:ClassBreaksRenderer field="RENTER_OCC">
<esri:ClassBreakInfo label="0 to 500"
maxValue="500"
minValue="0"
symbol="{sfs0}"/>
...

Dynamically generate renderers server-side

Another option is to have ArcGIS Server generate renderers that can then be applied to dynamic
services. A new task was introduced with the Flex 3.x API calledGenerateRendererTask.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

This task groups data using a classification method such as ClassBreaksDefinition or


aUniqueValueDefinition, resulting in a renderer object. This renderer can then be applied to a
dynamic service where the service applies this renderer to its output image.
How does the GenerateRendererTask work?

When an ArcGISDynamicMapServiceLayer loads, you should verify


thatsupportsDynamicLayers is true. Once this is done, call
thecreateDynamicLayerInfosFromLayerInfos() method. This returns an array
ofDynamicLayerInfo objects. The DynamicLayerInfo class has a source property which
references a LayerMapSource that represents the dynamic layer in the map service. This
LayerMapSource is used to set the GenerateRendererTask's source property.
The GenerateRendererParameters object allows you to set the classificationDefinitionand then
the GenerateRendererParameters object is passed to the
GenerateRendererTask's execute method. The renderer is then returned from the task, you then
create a new LayerDrawingOptions object and set the layerID to that of the
LayerMapSource's mapLayerID property. The generated renderer should then be applied to this
newly created LayerDrawingOptions renderer property.
Sample snippet taken from Generate renderers sample
<!--detailsTask_getAllDetailsCompleteHandler-->
...
layerMapSource = DynamicLayerInfo(dynamicLayerInfosArr[i]).source as LayerMapSource;
generateRendererTask.source = layerMapSource;
...
generateRendererTask.execute(generateRendererParams);
<!--generateRendererTask_executeCompleteHandler-->
...
var layerDrawingOptions:LayerDrawingOptions = new LayerDrawingOptions();
layerDrawingOptions.layerId = layerMapSource.mapLayerId;
//states layer id in the service
layerDrawingOptions.renderer = renderer;
...
var layerDrawingOptionsArr:Array = [ layerDrawingOptions ];
demographicsLayer.layerDrawingOptions = layerDrawingOptionsArr;
...

Note:

The GenerateRendererTask's source property can also be a dynamic layer that does not exist in a
map service. The sample, Thematic maps by table join, uses attributes from a joined table that is
not in a map service.

Dynamic labeling
New at ArcGIS 10.1 is the ability to alter a map service during the request and change its
rendering. This includes the ability to generate on-demand labels for features. In the previous

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

section we discussed working with the LayerDrawingOptions class and how useful it is to
modify symbology of a dynamic service. This class has the showLabels,scaleSymbols,
and labelClasses properties to aid with dynamic labeling. Setting showLabels=false indicates that
labels will not be displayed within the map. You must explicitly set this property for it to be
recognized. Setting the scaleSymbols property to false stops the layer from rendering its
symbols based on scale. Similar to showLabels , this must be explicitly set for it to be used.
The labelClasses property is an array ofLabelClass objects that is used to declare what will be
labeled. By using various LabelClasses and setting scale thresholds you can control how features
are labeled. You can achieve this by labeling features with different fields using the
LabelClass'labelExpression property. You can also control what labels are displayed by filtering
them using the where property.
Snippet taken from Dynamic labeling sample
<esri:layerDrawingOptions>
<!-- Layer drawing options for the states layer -->
<esri:LayerDrawingOptions layerId="3" showLabels="true">
<esri:ClassBreaksRenderer field="RENTER_OCC">
<esri:ClassBreakInfo label="58,094 to 216,867"
maxValue="216867"
minValue="58094"
symbol="{sfs0}"/>
...
...
<esri:labelClasses>
<esri:LabelClass id="initialLabelExpression"
labelExpression="[RENTER_OCC]"
labelPlacement="esriServerPolygonPlacementAlwaysHorizontal"
maxScale="18489298">
<esri:LabelOptions haloColor="0xFFFFFF" haloSize="2"/>
...
...

Change layer order


Another option when dynamically altering symbology is to change the order of your map
service's layers and how they display index within the table of contents. The
ArcGISDynamicMapServiceLayer's dynamicLayerInfos property accomplishes this. See
the Change Layer Ordering sample for additional information regarding this.
Snippet taken from Change Layer Ordering sample
private var dynamicLayerInfos:Array;
...
protected function usaLayer_loadHandler(event:LayerEvent):void
{
dynamicLayerInfos = usaLayer.createDynamicLayerInfosFromLayerInfos();
for (var i:int = 0; i < dynamicLayerInfos.length; i++)
{
layerList.addItem({ data: dynamicLayerInfos[i], label:
checkLayerNameForDisplay(DynamicLayerInfo(dynamicLayerInfos[i]).name)});

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


}
layerList.addEventListener(CollectionEvent.COLLECTION_CHANGE, layerListCollectionChangeHandler,
false, 0, true);
}
...
protected function layerListCollectionChangeHandler(event:CollectionEvent):void
{
if (event.kind == "remove")
{
movingLayerName = event.items[0].label;
//add 1 to the position for readability
removePosition = event.location + 1;
}
else if (event.kind == "add")
{
//add 1 to the position for readability
addedPosition = event.location + 1;
for (var i:int = 0; i < layerList.length; i++)
{
dynamicLayerInfos[i] = layerList.getItemAt(i).data;
}
usaLayer.dynamicLayerInfos = dynamicLayerInfos;
movingText.visible = true;
}
}

Additional Resources

Generate renderers
Unique value renderer
Range value renderer
Change layer ordering
Thematic maps by table join
Join to dynamic workspace
ArcGIS Help - Standard classification methods in ArcGIS
ArcGIS Help - Using unique values to display categories

Best practices for displaying data


In this topic

Displaying data

Version 3.7

Displaying data

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

When displaying information in your web application, it is important to consider whether the
data should be displayed as client-side graphics or, rather, a server-generated image result. There
are many factors to consider when choosing which option works most efficiently. Below are just
a couple of considerations. These are not all-inclusive but are provided as an example for some
things you may want to consider when developing your ArcGIS API for Flex web application.
Network payload

In other words, how much data is being transmitted over the network from the server hosting
ArcGIS Server or Online and the client, e.g. the web browser displayed the web application.
Generally, any data that is returned via a task, e.g. a query, would be in the form of
a FeatureSet object. The FeatureSet object contains an array of graphicsfeatures. These features
are Graphic objects. A graphic contains geometry, attributes, and a symbol. All of this is returned
from the server in either: JSON format or AMFformat.
One consideration when determining network traffic is the level of detail per feature. Returning a
FeatureSet of 50 simple points, e.g. cities, will not be the same as returning a FeatureSet of 50
detailed polygons, e.g. counties with non-generalized boundaries. Ideally, you would want your
information to pass from server to client or vice-versa as quickly as possible. Two common
examples of information transfer can be seen in the scenarios below:

Server to client - performing a query to return a FeatureSet of graphics to the client


Client to server - using the Draw tool to create features client-side and subsequently sending
these features to the server

Tip:

If trying to determine network traffic between server and client, a good resource to use are
browser-based tools such as Mozilla's Firebug for Firefox, Internet Explorer's Fiddler, Developer
Tools for Google Chrome, and/or Safari's Web Inspector.
Performance

When many graphics are rendered, especially those with complex geometries, client-side
performance can suffer. Please see Performance considerations in the Query topic for more
detailed suggestions. When specifically working with a query, a couple of suggestions to
increase performance are to use generalized copies of data whenever possible or provide
the maxAllowableOffset to generalize the returned geometry.
Please see the following examples for more information on how to use maxAllowableOffset:

Web map in App


Generalized data

Rendering

Think about how results should be generated and how does the end user of your web application
need to interact with these results. Question whether it is necessary for all of the information to
be sent client-side in order to interact with the data. For example, should you mouse over a

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

feature to see a tooltip? Or, as an alternative, could you generate the result server-side and just
display the returned image? How many features are drawn at various scale levels? Use scale
dependencies if appropriate. Prior to ArcGIS 10.1 and the Flex 3.x API, most web applications
used client-side graphics for display scenarios. Now with 10.1 and 3.x, there are more options to
render content server-side and display results on the client. More information regarding how this
is accomplished can be found in the Dynamic Workflows section of the help.

Pop-up windows
In this topic

Displaying the pop-up window for a feature

Configuring pop-up windows

Version 3.7
Pop-up windows are windows that provide information about features. Pop-up
windows can include descriptive text, links, images, and charts. Pop-up windows
can be created with the ArcGIS API for Flex and the new PopUpRenderer class.
They can also be created on ArcGIS.com using the ArcGIS.com map
viewer or ArcGIS Explorer Online.
A feature on the map can have descriptive information that is displayed in a popup window when you click the feature. This descriptive information can include a
title, text, links to other websites, media elements such as an image, or a graph
derived from the properties of the feature. It can also provide links to attachments
of the feature.
You can configure what is displayed in the pop-up window for the features in
each layer in the map, specifying how the fields (attributes) of each feature are
represented in the pop-up window. You can also configure the pop-up window in
several different ways.

Displaying the pop-up window for a feature

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

To display a pop-up window for a feature, click the feature on the map. Some features may not
be configured to show a pop-up window. When viewing a feature's pop-up window, you can
interact with the content to click links, interact with media, open attachments, and so on.
If the pop-up content has multiple media elements, you can click the arrows on the sides of the
pop-up window to page through each media element.
To close a pop-up window, click the close button at the top right of the pop-up window, or click
anywhere on the map.

Configuring pop-up windows


In the ArcGIS API for Flex, the pop-up window is configured with the PopUpRenderer class.

Styling and skinning overview


In this topic

About styling and skinning

Additional references

Version 3.7

About styling and skinning


Creating an alternate visual appearance to components gives a unique branding value to your
application. Styling and skinning are two approaches for changing the look of Flex components.
Styles are used to change the appearance of a single component or apply them across all
components. The appearance of components is changed using Cascading Style Sheets (CSS). In
Flex 4, skins control all visual elements of a component including the layout. The new skinning
model gives developers greater control over the appearance and layout of their components. With
custom skins you can change the look of your application including adding background colors
and images, borders, and so on. The decoupling of display logic with skins is one of the most
valuable architectural enhancements in Flex 4. This decoupling allows you to create an unlimited
number of skins for each of the Spark-based components. You can then declare a different
default skin for each instance of the same component or even swap skins on-the-fly.
The skin class of a component defines the visual appearance of a component. Modifying the skin
class of a component enables you to change just the visual appearance of a component without
affecting the business logic or behavior of the component. Creating a unique appearance for
components involves creating a new skin class or modifying an existing skin class. The source
code for the default skins used by all the components in ArcGIS API for Flex such as navigation,
scale bar, editor, attribute inspector, template picker, and so on, are provided with the API
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

download. These skins can be used as a starting point to create a custom look and feel for your
application. There are some alternate skins available in the download that can readily be used in
your applications. The source code for the skin classes can be found under
the <Extracted_API_Download_Location>/src/com/esri/ags/skins folder. See the following
screen shot:

To get a better understanding of the Flex framework's styling and skinning architecture, read
Adobe's Enhancing the user interface.
For specific information on how to change the appearance of the different ArcGIS API for
Flex components, see Navigation or ScaleBar.

Styling and skinning navigation


In this topic

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

About styling and skinning navigation

Version 3.7

About styling and skinning navigation


The navigation slider is used to display layers at predefined scales. It consists of a slider, and
zoom-in and zoom-out buttons. This topic shows how you can change the default look of the
navigation control to suit your project.

The following table shows various ways to change the navigation slider:
Different ways of changing the navigation slider

Changing the location of the navigation slider


using Cascading Style Sheets (CSS):

Copyright 2016 Esri. All rights reserved.

Horizontal navigation slider using an alternate


skin:

Different zoom
custom skin:

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Different ways of changing the navigation slider

Changing the location of the navigation slider using styles

The CSS style property places the slider at a distance of 30 pixels from the top and right margin
on the map. Since the left property is a default property, you have to use the not a number
(NaN) value so that the left property value is not used.
Notice the @namespace directive and the qualified reference to the esri|Navigation scale bar.
Components whose attributes are changed need to be uniquely identified to avoid class name
collision.
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|Navigation
{
top: 30;
right: 30;
left: NaN;
}
</fx:Style>

Changing the orientation of the navigation slider using an alternative skin

The default orientation of the navigation slider is vertical. Depending on your application
requirements, you can change the orientation of the navigation slider to horizontal. An alternate
skin is available in the application programming interface (API) that can be used for this
purpose. The reference to this alternate skin class is set as shown in the following code:
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|Navigation
{
skin-class: ClassReference("com.esri.ags.skins.NavigationHorizontalSkin");
}

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


</fx:Style>

Changing the zoom-in and zoom-out button using skinning

Creating a custom skin can further enhance the look of the navigation slider. In the following
screen shot, alternate images are used for the zoom-in and zoom-out button, and the tooltip is
customized to display tile level (instead of map scale).
You can modify the default skin class of the navigation control to create an alternate look. Do the
steps in the following sections to create this new look:
Copying the default skins used by the navigation control into your project

By default, the navigation control uses the NavigationSkin.mxml,


NavigationZoominButtonSkin.mxml, and NavigationZoomoutButtonSkin.mxml skin classes.
Copy these three files from the <Extracted_API_Download_Location>/skins/src folder into the
/src folder of your Flex project, then rename the files. See the following:
1. Rename NavigationSkin.mxml to MyNavigationSkin.mxml.
2. Rename NavigationZoominButtonSkin.mxml to MyNavigationZoominButtonSkin.mxml.
3. Rename NavigationZoomoutButtonSkin.mxml to MyNavigationZoomoutButtonSkin.mxml.

Modifying the MyNavigationSkin.mxml skin class

This is the default skin class that consists of the slider, and buttons for zooming in and out of the
map. Modify this skin to provide a new format for the tooltip and change the skins for the zoomin and zoom-out buttons.
1. Do the following to modify tooltip value:

Refer to the function formatSliderDataTip . This function is used to calculate the value for the
tooltip that is visible when the thumb of the slider is pressed. By default, the tooltip is set to the
scale of the map. It is modified as follows to display the tile level:
private function formatSliderDataTip(value:Number):String
{
const lod:LOD = hostComponent.map.lods[value];
return lod ? (lod.level + 1).toString() : "Error";
}

2. Do the following to modify the ToolTip appearance:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

CSS properties are used to change the ToolTip appearance. The modified ToolTip has a blue
background with a bold font type. The CSS class selector looks like the following:
<fx:Style>
.tooltipStyle
{
backgroundAlpha: 1.0;
backgroundColor: haloBlue;
fontWeight: bold;
color: white;
}
</fx:Style>

The defined style class is set to the dataTipStyleName property of the slider as shown in the
following code:
<mx:VSlider id="slider"
dataTipFormatFunction="formatSliderDataTip"
...
dataTipStyleName="tooltipStyle"/>

3. Do the following to change the skin class for the zoom-in and zoom-out buttons:

Set new skin class references to the zoom-in and zoom-out button. The new skin classes change
the icons for the buttons. You will create these referenced skin classes in the subsequent step.
<s:Button id="zoomInButton"
...
skinClass="MyNavigationZoomInButtonSkin"
... />
...
<s:Button id="zoomOutButton"
...
skinClass="MyNavigationZoomOutButtonSkin"
... />

The modified MyNavigationSkin.mxml file looks like the following:


<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Metadata>
[HostComponent("com.esri.ags.components.Navigation")]
</fx:Metadata>
<fx:Declarations>
<mx:NumberFormatter id="numberFormatter" rounding="nearest"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.esri.ags.layers.supportClasses.LOD;
private function formatSliderDataTip(value:Number):String
{

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


const lod:LOD = hostComponent.map.lods[value];
return lod ? (lod.level + 1).toString() : "Error";
}
]]>
</fx:Script>
<fx:Style>
.tooltipStyle
{
backgroundAlpha: 1.0;
backgroundColor: haloBlue;
fontWeight: bold;
color: white;
}
</fx:Style>
<s:states>
<s:State
<s:State
<s:State
<s:State
</s:states>

name="normal"/>
name="disabled"/>
name="normalWithSlider"/>
name="disabledWithSlider"/>

<s:Rect bottom="0"
left="0"
radiusX="10"
radiusY="10"
right="0"
top="0">
<s:fill>
<s:SolidColor alpha="0.5" color="0x000000"/>
</s:fill>
</s:Rect>
<s:VGroup gap="2"
horizontalAlign="center"
minHeight="34"
paddingBottom="5"
paddingLeft="3"
paddingRight="3"
paddingTop="4">
<s:Button id="zoomInButton"
enabled.disabled="false"
enabled.disabledWithSlider="false"
skinClass="MyNavigationZoomInButtonSkin"
toolTip="{resourceManager.getString('ESRIMessages', 'zoomInTooltip')}" />
<mx:VSlider id="slider"
dataTipFormatFunction="formatSliderDataTip"
dataTipPlacement="left"
enabled.disabled="false"
enabled.disabledWithSlider="false"
enabled.normalWithSlider="true"
height="160"
includeIn="normalWithSlider,disabledWithSlider"
liveDragging="false"
maximum="{hostComponent.map.lods.length - 1}"
showDataTip="true"

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


snapInterval="1"
tickColor="#000000"
tickInterval="1"
tickLength="3"
tickOffset="-3"
tickThickness="1"
value="{hostComponent.map.level}"
dataTipStyleName="tooltipStyle"/>
<s:Button id="zoomOutButton"
enabled.disabled="false"
enabled.disabledWithSlider="false"
skinClass="MyNavigationZoomOutButtonSkin"
toolTip="{resourceManager.getString('ESRIMessages', 'zoomOutTooltip')}"/>
</s:VGroup>
</s:Skin>

Modifying the MyNavigationZoomInButtonSkin.mxml skin class

Change the bitmap image that is used as the icon image to display the zoom-in button. The
following code shows an image file named home_icon.png that is used as the source for the
bitmap image to display the button:
<s:BitmapImage
bottom="0"
...
source="@Embed(source='/assets/home_icon.png')"
source.disabled="@Embed(source='/assets/home_icon.png')"
source.down="@Embed(source='/assets/home_icon.png')"
source.over="@Embed(source='/assets/home_icon.png')"
/>

The modified MyNavigationZoomInButtonSkin.mxml file looks like the following:


<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minHeight="10"
minWidth="10">
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<s:states>
<s:State
<s:State
<s:State
<s:State
</s:states>

name="disabled"/>
name="down"/>
name="over"/>
name="up"/>

<s:BitmapImage
bottom="0"
left="0"
right="0"

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


source="@Embed(source='/assets/home_icon.png')"
source.disabled="@Embed(source='/assets/home_icon.png')"
source.down="@Embed(source='/assets/home_icon.png')"
source.over="@Embed(source='/assets/home_icon.png')"
top="0"
/>
</s:Skin>

Modifying the MyNavigationZoomOutButtonSkin.mxml skin class

Change the bitmap image that is used as the icon image to display the zoom-out button. The
image file, globe_icon.png , is used as the source for the bitmap image that is used to display the
button.
<s:BitmapImage
bottom="0"
...
source="@Embed(source='/assets/globe_icon.png')"
source.disabled="@Embed(source='/assets/globe_icon.png')"
source.down="@Embed(source='/assets/globe_icon.png')"
source.over="@Embed(source='/assets/globe_icon.png')"
/>

The modified MyNavigationZoomOutButtonSkin.mxml file looks like the following:


<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minHeight="10"
minWidth="10">
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<s:states>
<s:State
<s:State
<s:State
<s:State
</s:states>

name="disabled"/>
name="down"/>
name="over"/>
name="up"/>

<s:BitmapImage
bottom="0"
left="0"
right="0"
source="@Embed(source='/assets/globe_icon.png')"
source.disabled="@Embed(source='/assets/globe_icon.png')"
source.down="@Embed(source='/assets/globe_icon.png')"
source.over="@Embed(source='/assets/globe_icon.png')"
top="0"
/>
</s:Skin>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Referencing the modified navigation skin class in your application

The modified skin class can now be used in your application by setting the reference in the skin
class property. The following code shows the modified skin class referenced in the 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">
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|Navigation
{
skin-class: ClassReference("MyNavigationSkin");
}
</fx:Style>
<esri:Map >
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
</esri:Map>
</s:Application>

Styling and skinning the scale bar


In this topic

Changing the navigation slider

Changing the position of the scale bar using styles

Choosing the unit system to display (for example, only metric units) using an alternate
skin

Changing the visual appearance using a custom skin

Version 3.7
The position and visual attributes of the scale bar can be changed by using the
Cascading Style Sheets (CSS) style properties and/or a custom skin.

Changing the navigation slider


The following are the different ways to change the navigation slider:

Change the position of the scale bar using CSS styling.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Show only metric units using an alternate skin. See the following:

Different looking scale bar using a custom skin:

Changing the position of the scale bar using styles


By default, the scale bar is positioned at the lower left hand corner on the map. Modifying the
style properties enables you to change this default position. The following code positions the
scale bar at the bottom right hand corner on the map:
<?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">
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|ScaleBar
{
left: NaN;
right: 5;
bottom: 5;
}
</fx:Style>
<esri:Map id="myMap" >
<esri:ArcGISTiledMapServiceLayer id="tiled"
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
</esri:Map>
</s:Application>

Notice the "@namespace" directive and the qualified reference to the scale bar "esri | ScaleBar".
Components whose attributes are changed need to be uniquely identified to avoid class name
collision.
Since the "left" property is the default property, set it to not a number (NaN) to allow other
position properties such as "right" and "bottom" to take effect.
Similarly, the following code snippet positions the scale bar in the upper right hand corner on the
map.
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|ScaleBar
{
left: NaN;
right: 5;

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


top : 5;
}
</fx:Style>

Choosing the unit system to display (for example, only metric


units) using an alternate skin
The scale bar by default displays distances in both the U.S. and metric systems. Depending upon
the requirement of your application, you may want to display the distance only in metric units.
To satisfy this requirement, specify an alternate SkinClass for the scale bar.
The default skin class used by the scale bar is "com.esri.ags.skins.ScaleBarSkin." There are some
alternate skin classes available at <Extracted_API_Download_Location>/skins/src" such as
"com.esri.ags.skins.ScaleBarMetricSkin" and "com.esri.ags.skins.ScaleBarUSSkin". To use one
of these alternate skin classes for the scale bar, reference the skin class shown as follows:
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|ScaleBar
{
skin-class: ClassReference("com.esri.ags.skins.ScaleBarMetricSkin");
left: NaN;
right: 5;
top : 5;
}
</fx:Style>

Changing the visual appearance using a custom skin


You can modify the default skin class of the ScaleBar component to create an alternate look for
the scale bar. To modify the skin class for the ScaleBar component, see the following sections.
Copying the default skin class for the ScaleBar component

The ArcGIS API for Flex ships with the source code for the default skin classes of all the visual
components. The default skin class used by the ScaleBar component is
"com.esri.ags.skins.ScaleBarSkin" and is located under the
<Extracted_API_Download_Location>/skins/src" folder.
Copy the file ScaleBarSkin.mxml in to the "src" folder of your Flex project and rename the file
to MyScaleBarSkin.mxml. See the following:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Modifying the skin class

Since you only need metric units displayed in the scale bar, delete the code for calculating U.S.
units, label for displaying U.S. units, and the line components. The modified code of the skin
resembles the following:
<s:Skin xmlns:fx=http://ns.adobe.com/mxml/2009
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="200">
<fx:Metadata>
[HostComponent("com.esri.ags.components.ScaleBar")]
</fx:Metadata>
<fx:Script>
<![CDATA[
override protected function measure():void
{
labelMetric.text = hostComponent.textMetric;
labelMetric.x = hostComponent.lengthMetric labelMetric.getExplicitOrMeasuredWidth() * 0.5;
super.measure();
}
]]>
</fx:Script>
<s:Label id="labelMetric" fontFamily="Verdana" fontSize="9" y="0"/>
</s:Skin>

You can now add a rectangle to display the distance in metric units. The code for the skin class
resembles the following:
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="200">
<fx:Metadata>
[HostComponent("com.esri.ags.components.ScaleBar")]
</fx:Metadata>
<fx:Declarations>
<s:SolidColorStroke id="solidColorStroke" color="0x000000" weight="2"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
override protected function measure():void
{
labelMetric.text = hostComponent.textMetric;
labelMetric.x = hostComponent.lengthMetric + 5;
super.measure();
}
]]>
</fx:Script>
<s:Rect width = "{hostComponent.lengthMetric}" height="5">
<s:fill>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


<s:SolidColor color="0xFF0000"/>
</s:fill>
</s:Rect>
<s:Label id="labelMetric" fontFamily="Verdana" fontSize="9" y="0" fontWeight="bold"/>
</s:Skin>

You have now added a rectangle with red as the fill color. Also note that the "x" position of the
label "labelMetric" has been adjusted to be placed at the end of the rectangle.
Setting a reference to the modified skin class

Now that you have modified the skin class, it needs to be referenced using the "skin-class"
property in the application. The following code snippet shows how to reference the modified
skin class in the 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">
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|ScaleBar
{
skin-class: ClassReference("MyScaleBarSkin");
}
</fx:Style>
<esri:Map >
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
</esri:Map>
</s:Application>

You can see that by changing the skin class, you can create different variations for the visual
appearance of the scale bar without changing any of the business logic of how the distances are
calculated.

Geocoder
In this topic

Search and find functionality

Additional Information

Version 3.7

Search and find functionality

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The Geocoder component provides easy map navigation by adding a search box. This search box
enables users to move to a location much quicker and easier than standard panning/zooming. The
search box provides the search capabilities based on a given locator service and/or map services.

This component wraps pre-built search functionality directly in it so all you need to do is
reference the component within your application. If working with a locator, the component
defaults to the ArcGIS Online World Geocoding Service. It can also be customized to work with
another defined geocoding service. In addition to geocoding services, the Geocoder component
also has the ability to work with or without layers within your map service. You specify how you
wish the component to work by using either a geocoding service, map service layer(s), or both.
This component provides properties such as whether you wish to have the results autocomplete
and navigate once found. You can also specify whether you wish to work
with GeocoderLocatorOptions.. A couple of these options include properties such as what fields
you wish to display in the resulting features and the search extent used when geocoding.
This geocoding capability works off of a locator service that is configured to use a single line
address field.
Note:

If using your own geocode locator service, it will need to be configured to use single line style
similar to how the default locator service is configured.
If you wish to search using map service layer(s). Reference the mapServices property on the
Geocoder component. This property takes an array of geocoderMapServices. Here, you can
specify the layerids you wish to search, fields to search, and so forth. The selected search result
is returned as a GeocoderSearchResult. After the results display, listen for
the resultSelected event and handle the results as needed.

Additional Information
See the Geocoder API sample for additional details.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

In addition to the API sample, you may also want to take a look at the GeocoderComponent in
the ArcGIS Viewer for Flex application. This takes the underlying Geocoder component and
uses it to perform similar search functionality within the Viewer. The source for the Viewer can
be accessed from Github. Once in the application, you can find this component
under src/com.esri.viewer/components .

Using Query
In this topic

Version 3.7
Tip:

In addition to using a query task, you may also want to consider working with a FeatureLayer as
it provides similar functionality. More information can be found at the FeatureLayer topic in
addition to the sample, Search with FeatureLayer.
Query task

In this topic, you will learn how to use a query task to query information from ArcGIS for Server
service. You will use Query, QueryTask, and FeatureSet to query a layer in a map and display
the results. The typical four steps involved in a query process are as follows:
1. Set up the Map and GraphicsLayer.
2. Set up the query task with a query filter.
3. Execute the query task with user inputs, for example, by selecting features on a map, choosing a value
from a list, or typing a value.
4. Display the query results returned in a FeatureSet. The FeatureSet is comprised of both geometry and
attributes of the selected features. The geometry can be used for highlighting the features on the map
and attributes can be used to populate aDataGrid or a ToolTip.

The example used in this topic is a QueryTask where the user types in the name of a city. Based
on this input, all cities that match the name are displayed on the map. See the complete code at
the end of the Executing the query section.
Setting up the layers

The Map and its layers are used to provide a context to displaying the query results. The
GraphicsLayer is used to symbolize and display the geometries of the query results. The
following code snippet shows a map with an ArcGIS Server tiled map service layer and a
graphics layer added to the map. The features that are rendered by the graphics layer will use the
symbol defined by infoSymbol1 , which is explained later in this topic.
<esri:Map id="map">
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


World_Physical_Map/MapServer"/>
<esri:GraphicsLayer id="myGraphicsLayer" symbol="{infoSymbol1}"/>
</esri:Map>

It is not always necessary to have a map to perform a query. In situations where you just want to
populate a DataGrid with the query results, a map is not needed. See the Query result in
table sample as an example.
Setting up the query task

The QueryTask is set to a uniform resource locator (URL) of the layer that the query will work
against. The URL includes the layer ID. In the following code example, the layer ID is 0:
<esri:QueryTask id="queryTask"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0"
/>

The Query defines the criteria that will be used for executing the query. The actual filter is set by
the text attribute , i.e. shorthand for a WHERE clause using LIKE operator that is bound to the
value of a text input component that is discussed later in this topic. The field used is the display
field defined in the map document. You can determine the display field for a layer in the
Services Directory. Since you're going to display the results of the query, set
the returnGeometry attribute to true.
In this example, a list of output fields is included in outFields. When you specify the output
fields, limit the fields to only those you expect to use in the query or the results. The fewer fields
you include, the faster the response. You must use the actual field names rather than the aliases
although these aliases can be used in the results.
<esri:Query id="query" text="{qText.text}" returnGeometry="true">
<esri:outFields>
<mx:String>CITY_NAME</mx:String>
<mx:String>STATE_NAME</mx:String>
</esri:outFields>
</esri:Query>

Note:

If querying a Featurelayer, set the returning outfields on the Featurelayer rather than the query.
More about this and Featurelayers can be found at Feature Layer.
Executing the query

Displaying the results of the query involves adding the symbology to the graphic and adding the
graphic itself to the graphics layer. The symbology can be applied directly to a graphics layer,
and all graphics added to that graphics layer will then inherit that symbology.
Recall that when you added the graphics layer, you set the symbol to infoSymbol1 . The
following code shows the declaration of infoSymbol1 , which is a symbol of typeInfoSymbol.
The InfoSymbol has an infoRenderer that defines how information is rendered. In the following
example, data.CITY_NAME and data.STATE_NAME are the outfields that were previously set in the
query.
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

If the infoRenderer component inherits from a parent that implements IDataRenderer, all the
attributes of the graphic are available via the dataproperty. In the following example, the
component VBox has a parent 'container' that implements IDataRenderer. For more information,
refer to the Adobe Flex 3 Language reference.
<esri:InfoSymbol id="infoSymbol1">
<esri:infoRenderer>
<mx:Component>
<mx:VBox>
<mx:Label text="{data.CITY_NAME}"/>
<mx:Label text="{data.STATE_NAME }"/>
</mx:VBox>
</mx:Component>
</esri:infoRenderer>
</esri:InfoSymbol>

After the successful execution of the query, the callback function onResult() is called. One of
the arguments to the function is a FeatureSet object that contains the results of the query. The
features of the FeatureSet can be directly assigned to thegraphicProvider of the graphics layer to
be rendered on the map.
In case of a failure, the callback function onFault() is called, which, in the following example,
shows an alert box with information about the failure:
private function doQuery():void
{
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null ):void
{
myGraphicsLayer.graphicProvider = featureSet.features;
}
function onFault(info:Object, token:Object = null):void
{
Alert.show( info.toString() );
}
}

The following is the complete code for the scenario discussed in this topic:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:s="library://ns.adobe.com/flex/spark"
pageTitle="Query Task (with a map)">
<s:layout>
<s:VerticalLayout gap="10"
horizontalAlign="center"
paddingBottom="20"
paddingLeft="25"
paddingRight="25"
paddingTop="20"/>
</s:layout>
<fx:Script>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


<![CDATA[
import
import
import
import

com.esri.ags.Graphic;
com.esri.ags.FeatureSet;
mx.controls.Alert;
mx.rpc.AsyncResponder;

private function doQuery():void


{
queryTask.execute(query, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
// No code needed in this simple sample, since the
// graphiclayer is bound to the query result using
// graphicProvider="{queryTask.executeLastResult.features}"
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Layer with US Cities -->
<esri:QueryTask id="queryTask"
showBusyCursor="true"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0"
useAMF="false"/>
<esri:Query id="query"
outSpatialReference="{myMap.spatialReference}"
returnGeometry="true"
text="{qText.text}">
<esri:outFields>
<fx:String>CITY_NAME</fx:String>
<fx:String>STATE_NAME</fx:String>
</esri:outFields>
</esri:Query>
<esri:InfoSymbol id="infoSymbol1">
<esri:infoRenderer>
<fx:Component>
<mx:VBox>
<mx:Label text="{data.CITY_NAME}"/>
<mx:Label text="{data.STATE_NAME }"/>
</mx:VBox>
</fx:Component>
</esri:infoRenderer>
</esri:InfoSymbol>
</fx:Declarations>
<s:Panel backgroundColor="0xB2BFC6" height="60"
title="Query a layer (search for a city)">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:TextInput id="qText"

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


enter="doQuery()"
text="San Jose"
width="100%"/>
<s:Button click="doQuery()" label="Do Query"/>
</s:Panel>
<esri:Map id="myMap">
<esri:extent>
<esri:Extent xmin="-14298000" ymin="2748000"
xmax="-6815000" ymax="7117000">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/
World_Physical_Map/MapServer"/>
<esri:GraphicsLayer
id="myGraphicsLayer"
graphicProvider="{queryTask.executeLastResult.features}"
symbol="{infoSymbol1}"/>
</esri:Map>
</s:Application>

Performance considerations

There is a direct correlation between performance and the number of features selected; certain
queries are unrealistic or request too much data. The following list offers suggestions to enhance
performance:

If a large number of features is selected, it can take some time to draw the graphics on the map.
The type of feature also makes a difference. Points draw much faster than lines and polygons.
Therefore, use point graphics, e.g. MapPoint or MultiPoint , whenever possible.
If you're retrieving tabular data and don't intend to add graphics to the map, you should not
request geometry.
If queries are too large on a regular basis, limit the query to a smaller area or refine the query so
fewer features are returned at one time.
To prevent queries that request unlimited numbers of features (for example, empty WHERE
statements and statements that are always true), use MaxRecordCount to set the maximum
number of features. By default, the maximum for ArcGIS Server 10.x is 1000 features, 500
features for ArcGIS Server 9.3. Prior to ArcGIS for Server 10.1, you could modify this for a
specific MapService in its configuration file. For a default windows installation, the file
is C:\Program Files\ArcGIS\server\user\cfg\[YourMapService].cfg . As of version 10.1,
this can easily be configured when publishing your map service, see Editing service properties in
Manager, specifically the Maximum Number of Records Returned by Server parameter listed
in the Parameters tab on the left.
Queries on cached layers don't have scale dependencies. This means that features for a layer
can be queried even if the layer is not displayed on the map for a given scale. Thus, your query
should not be accessible for a layer if displaying the results does not make sense to the end user.

Editing
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

In this topic

How do I add editing functionality to my application?

How does editing work?

Designing your editing experience

Version 3.7
The ArcGIS APIs for Flex and JavaScript have the ability to edit geographic data over the Web.
Since a Web browser is a simple, familiar and free application, Web-based editing allows a
larger group of people to add and improve on your data. These include field workers, analysts in
other departments of your company, or perhaps even crowd-sourced volunteers who may be able
to make valuable contributions to your data given a simple editing interface.
The APIs include components (or widgets) that help you add editing functionality to your
applications. You can do some design work in both your map and your Web application to
simplify the end user experience when editing. For example, you might predefine a set of feature
templates, introduced at 10.0, to make it easier for users to add certain types of common features.
You might also limit the attributes that can be added, and add some available attribute options in
a drop down list to facilitate accurate, uniform data entry. As the designer of a Web editing
application, you have complete control over how simple or complex of an editing experience you
expose to your users.
Web editing requires some initial setup of a feature service, which exposes information about a
layer's feature geometries and attributes. Also, geometry services can be used to accomplish
some Web editing tasks. In order to use the main Editor component, for example, you must have
a running geometry service.
What can I do with editing in the ArcGIS Web APIs?

The ArcGIS Web APIs provide simple feature editing. The features must come from an ArcSDE
geodatabase. This geodatabase can be licensed for either workgroup or enterprise use and does
not have to be versioned.
When editing data with the Web APIs, you can add, delete, cut (split), merge (union), and
reshape features. You can also edit feature attributes. If you attempt to modify the same feature
at the same time as someone else, the last edits to be made are the ones committed to the
database.
For certain Web editing workflows, it is a good idea to have an analyst using ArcGIS for
Desktop periodically review the edits to verify data integrity. Although the editing components
can perform some data validation, other tasks such as validating topologies cannot be performed
over the Web.

How do I add editing functionality to my application?


Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The ArcGIS API for Flex provides multiple components to make it easier for you to add editing
functionality to your Web applications.
Editor component

If you want to get started quickly, or if you just want to use the default editing interface included
with the API, use the Editor component. The Editor component combines the functionality of the
other components to provide everything that you need for editing a layer. You can choose the
number and types of tools that are available on the component.
The Editor component saves your edits immediately after they are made, for example, as soon as
you finish drawing a polygon. If you decide not to use the Editor component, you must
determine for yourself when and how often you want to apply edits.
If you don't use the Editor component, you need to code your own editing experience. However,
you can still take advantage of the DrawTool, EditTool, TemplatePicker, AttributeInspector and
AttachmentInspector to help you - as shown in the Edit without Editor sample.
TemplatePicker component

The TemplatePicker component displays a set of pre-configured feature choices that the user can
create. The Template Picker is a great way to expose pre-configured feature types for easy
editing and quality control. The symbols in the Template Picker come directly from the editing
templates that you defined in the map document of your feature service.
A Template Picker is included in the Editor component. The Template Picker can also be used
on its own as a simple legend for your map.
AttributeInspector component

When you make attributes available for editing on the Web, you need to provide an interface for
users to edit the attributes, and you must ensure that the data they enter is valid. The Attribute
Inspector component can help you with both these tasks.
The Attribute Inspector reads the attribute fields available through your feature layerand provides
a user interface for easily updating those fields. It also validates data entered in the fields,
ensuring that the input matches the expected data type. For example, if a coded value domain is
applied to a field, the permitted values appear in a drop down list, restricting the possibility of
other values being entered. If a field requires a date value, a calendar appears, helping the user to
supply a valid date.
The Attribute Inspector exposes the available attributes on the layer for editing. Use the
outFields property on the FeatureLayer to set the available attributes.
An Attribute Inspector is included in the Editor component.
AttachmentInspector component

In some situations, you may want to associate a downloadable file with a feature. For example,
you might want users to be able to click a feature representing a piece of real estate and see a link

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

to a PDF file of the title deed. In the ArcGIS Web APIs, an associated downloadable file like this
is known as a feature attachment. See the FAQ onHow do I upload large attachments.
The AttachmentInspector component helps users upload and view the list of feature attachments.
The Attachment Editor includes a list of current attachments (with Remove buttons), as well as a
Browse button that can be used to upload more attachments. The Attachment Editor works well
inside an InfoWindow, but can be placed elsewhere on the page.
In order to use feature attachments, attachments must be enabled on the source feature class. You
can enable attachments for a feature class in ArcCatalog or the Catalog window in ArcMap.
RelationshipInspector component

Many times while viewing features, either in the form of a pop-up dialog or even a table, you
may wish to view, or possibly edit, any related features or records associated with that feature.
The RelationshipInspector component was added with version 3.1 and allows end-users to view
related records for features as well as add or delete related records.
You can think of this component as a 'building block' used in other components. For example,
you could use this in both the Pop-up window and/or an AttributeTablecomponent. This
component's functionality and use is very similar to the AttachmentInspector component. For
example, you can view and add attachments on a given feature. Many times you can view the
associated attachment inside a pop-up window. The same premise can be applied to relates as
well.
Note:

Adding of related records using the RelationshipInspector component is only supported when
using ArcGIS 10.1 or later. Also, the related "table" is an actual table and not a layer. Also
adding of related records is not supported if the cardinality is defined as 1-to-1 and there is
already a related record for a given feature.
Tip:

In order for your ArcGIS service to have relationships, your geodatabase needs to have
relationship classes or you need to configure relates in the map document. For more information
about configuring your service to support related records, read the ArcGIS Help.

How does editing work?


Editing with the ArcGIS Web APIs works through the feature service, a new type of service
available with ArcGIS 10.0. Editing workflows can also take advantage of the geometry service.
The role of the feature service

Web editing requires a feature service to provide the symbology and feature geometry of your
data. The feature service is just a map service with the Feature Access capability enabled. This

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

capability allows the map service to expose feature geometries and their symbols in a way that is
easy for Web applications to use and update.
Before you build a Web editing application, you need to do some work to create a feature service
exposing the layers that you want to be edited. This involves setting up a map document and,
optionally, defining some templates for editing. Templates allow you to pre-configure the
symbology and attributes for some commonly-used feature types. For example, to prepare for
editing roads, you might configure templates for "Controlled Access Freeway", "Other Divided
Highway", "State Highway", and "Local Road". Templates are optional, but they make it easy
for the end user of the application to create common features.
Once your map is finished, you need to publish it to ArcGIS Server with the Feature Access
capability enabled. This creates REST URLs, or endpoints, to both a map serviceand a feature
service. You will use these URLs to reference the services in your application.
Feature services are accessible in the Web APIs through a new type of layer called afeature
layer. Feature layers can do a variety of things and can reference a layer in either a map service
or a feature service; however, when you use a feature layer for editing purposesyou need to
reference a layer in a feature service.
When you perform editing, your Web application tells the feature layer which attributes have
changed and, if applicable, how the geometry changed. The feature layer also displays the
updated features after editing. You can call the applyEdits() method on the feature layer to apply
the edits, which then commits them to the database.
The role of the geometry service

The ArcGIS Server geometry service helps perform common editing operations such as creating,
cutting, and reshaping geographic features. Before you use the Editor component, you need to
create a geometry service on your ArcGIS Server. Then when you create the Editor component,
you must provide the URL to the geometry service. The component uses the service behind the
scenes, and you won't have to call methods on the geometry service yourself unless you decide
not to use the component.
If you decide not to use the Editor component, you can still use the geometry service to help you
code your own editing tools. The geometry service can also help you validate data. For example,
you can use the geometry service to perform checks on edits, such as "no edit may fall outside
this box", or "a polygon boundary may not cross itself". The Editor component actually calls the
simplify() method on the geometry service before it commits a geometry to your database.
Although ArcGIS topology validation is not available through the Editor component or editingrelated classes, the geometry service may help you achieve a similar result through these types of
data integrity checks.
The EditTool

The EditTool helps you move graphics or their individual vertices. This is helpful in scenarios
where you are not using the Editor component and you need to write your own editing logic,
especially the client display behavior.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


The DrawTool

The DrawTool helps you create new features by drawing them. It is commonly used in
combination with the TemplatePicker to create new features based on the selected feature
template.

Designing your editing experience


When you build a Web editing application, it is important to think about who will use the
application and what they will need to do. You should provide your users no more and no less
than the tools they need. In most situations you can design an appropriate editing experience for
your users through a combination of the editing components included with the API. Keep in
mind that although the API includes a comprehensive Editor component to help you get started,
this particular component may not be the best fit for your scenario.
In some ways, the editing experience with the API has already been simplified for you. The
components include no buttons for starting and stopping edit sessions, or for saving edits. You
can provide these functions, but they're not necessary for most applications.
Consider the following approaches for designing a Web editing application. Each approach has
its own merits and types applications for which it is most appropriate.
Feature sketching

In this type of application, field analysts need to sketch simple events on the map, such as bird
sightings. The geographic precision of the edits is not as important as the event's attributes and
the fact that the event happened. In this type of an application, you can use a Template Picker to
limit the types of items users can sketch. The Attribute Inspector is also useful, either in a side
panel or in an info window that appears when the feature is clicked. Options for splitting and
merging features, adding a point at an X/Y location, snapping, or uploading feature attachments
may clutter the application and should be avoided unless absolutely needed.
View a sample that shows how to build a feature sketching application.
Attribute-only editing

Some editing applications include a mapping component, but don't require any changing of
geographic features. For example, you might want to create a Web application allowing any
office employee to edit the attributes of a parcel feature in your database. You want to prevent
them from editing the geometry, leaving that task to your GIS analysts. In this scenario, you can
include a map in your application, but expose editing only through the Attribute Inspector. A
simple map click on a parcel displays the attributes to be edited. You don't need to include any
buttons or components for creating, deleting, or reshaping features.
View a sample that shows how to build an attribute editing application.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Citizen participation, or geo-wiki

In this type of application, citizens can be the editors and report problems to a government
organization by placing points on the map and including ancillary information such as
photographs or a brief description.
Users of this type of application do not even know that they are editing GIS data. They are only
allowed to add point features to the database, using a carefully selected set of incident types that
you predefined in a Template Picker. Attachments are allowed through the Attachment Inspector
component so that citizens can upload images of the incident. Attribute editing may be allowed
to a very limited degree so that citizens can describe the incidents.
In this type of application, you may have to code some security checks to ensure that users can
only edit or delete their own incidents. You may also include logic to periodically clean out the
database, or allow a subset of authenticated users to close or delete incidents.
View a sample that shows how to build a citizen participation application.
Tip:

To get a good idea of how editing works. The ArcGIS Viewer for Flex's edit widget's source
code provides a good example of how to implement and work with this functionality. You can
download and access this at github. If you downloaded the entire application, refer to the files
located in thesrc/widgets/edit folder.

AttributeTable
In this topic

Working with the AttributeTable

Conceptual workflow

Additional references

Version 3.7
The AttributeTable component displays a tabular view of a feature layer's
attributes. If the feature layer is editable, you can edit the records within the table
widget as well. It recognizes layers added specifically as feature layers, whether
it be from a Feature Service or Dynamic Map Service. In addition to feature
layers that are directly added, it will also recognize any layers within a full
dynamic map service as well and display features within the extent.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Working with the AttributeTable


Once the web application loads, the AttributeTable component checks for any feature layer
feature(s) in the current extent and populates the attribute table with its feature(s). Aside from
providing a tabular display of the layer's data, the feature's can be selected, deselected, and
zoomed-to by interacting with the attribute table. If these feature layers are editable, the
corresponding feature attributes will also be editable. In addition, the fields can be sorted by
clicking on its heading.
The attribute table also has a Table Options dropdown combobox that allows you to choose
different functions such as:

Export the attributes to a CSV fileExports the attributes to a separate CSV file.
Note:

If records are selected, only the selected features are written to this file. If working with
point feature classes, two additional fields are also written into this CSV file indicating
latitude and longitude. This specific feature with points is only supported for Web
Mercator and Geographic spatial references.

Zoom to selected featuresZooms to the extent of the selected features.


Clear SelectionClears the current selection.
Delete selected features If editable, deletes the selected features.
Note:

This option is only enabled if the feature layer is editable.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Show attachmentsThis option is available if the feature layer has attachments enabled on it.
Show related recordsThis option is available if the feature layer has any associated
relationships.

Note:

If a Uniform Resource Locator (URL) exists as a field value in your service it will display as a
text string in the attribute table and not as a hyperlink.
If you are outside an extent and are not displaying any visible features, a message will appear
displaying "No features in current map extent". Also, if your scale is out of the visible range of
the layer, you will receive a message stating "Layer is out of scale range".

Conceptual workflow
Requires: Feature layers from either a dynamic map service or feature service.

Reads feature layers and populates the contents of the widget with the corresponding feature's
records within the current map extent. If more than one layer, multiple tabs will display in the
table.
Attribute table updates as feature(s) updates change with extent changes.
Interactive functionality between records and features in the map.
Edits can be performed on the records if the layer is editable.

Additional references
To test out this functionality, see the AttributeTable sample.

Directions
In this topic

Calculate directions

Additional Information

Version 3.7

Calculate directions
The Directions component provides a quick and efficient method of calculating directions
between two or more locations. Similar to how the existing routeTask works, this component

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

generates a route "finding a least-cost path between multiple services..." using a specified
network service.

This component wraps pre-built search and route functionality directly within it so all you need
to do is reference the component within your application. Starting with 3.3, the routing service
URL now defaults
to http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World . Prior
to this version 3.2, there was no default network routing service. This can be either a service
hosted by your own Server or one by ArcGIS Online (such as the default.)
Note:

ArcGIS Online Network Analysis Services require an ArcGIS Online subscription. Each
successful request to the service incurs service credits which are taken from your subscription.
More information regarding this can be found at Accessing Services topic of the Network
Analysis Services documentation.
The Directions component makes use of the Geocoder to determine the input locations. You can
perform this two ways:
1. Forward geocoding - this is handled via the standard method of typing an input location into a textbox.
2. Reverse geocoding - this is performed after clicking on a point within the map.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

All of this is handled by setting the Direction's locatorURL property. This points to a geocoding
locator service. Please see the Geocoder topic for additional information on how this component
works.
Similar to how the Geocoder component works, you can also specify input locations using map
services. These services can be used on their own or in conjunction with a locator service. If
wishing to work with map services, you would set them via
theDirectionsGeocodeOptions.mapServices property. If you wish to only work with map
services, you would set the map services as previously stated, in addition to setting
the locatorURL property to null , you would also want to set the useMapServiceOnly to true .
Once the input locations are determine, you can calculate the directions. This takes whatever
network route service set on the Direction's URL property.
Caution:

It is not possible to determine input locations by clicking on the map if only working with map
services.
The advantage of using the Directions component is that it encapsulates all of this in its UI. All
you need to do is provide the input locations and a URL to a route service. The resulting
directions and its symbology are all handled by the component and displayed appropriately. In
addition to calculating from-to directions, you can also reverse the calculated directions, display
textual step-by-step directions including total distance and time, which in turn can then be
printed.

Additional Information
See the Directions API sample for additional details.
In addition to the API sample, you may also want to take a look at the Directions widget in the
ArcGIS Viewer for Flex application. This takes the underlying Directions component and uses it
to perform similar search and route functionality within the Viewer. The source for the Viewer
can be accessed from Github. Once in the application, you can find this component
under src/widgets/Directions .

Geoprocessing tasks
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

In this topic

Obtaining the URL

Supplying the parameters

Running the task

Version 3.7
Geoprocessing allows you to automate your geographic information system (GIS) analyses by
creating custom tools and linking them within ArcGIS. You can arrange these tools in a logical
way to accomplish a multistep task in a single operation rather than a series of manually run
tools.
The Geoprocessor class in the ArcGIS API for Flex gives you access to various geoprocessing
tasks, which are exposed through services in the ArcGIS REST Services Directory.
To use the geoprocessing services, obtain the following information from the Services Directory:

The URL of the geoprocessing task


The required inputs and outputs of the task
The task type: synchronous or asynchronous

Obtaining the URL


The Services Directory links to all available services. The following screen shot shows a sample
geoprocessing service:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

From this page, you can see that the geoprocessing service Esri_Elevation_World is located in
the Elevation folder and runs on sampleserver1.arcgisonline.com.
The following page appears when you click the Viewshed geoprocessing model:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

To execute this geoprocessing task, copy and paste the following MXML code into your
application:
<esri:Geoprocessor
id="gp"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Elevation/ESRI_Elevation_World/GPServer/Viewshed"
/>

The equivalent code with ActionScript:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


var gp:Geoprocessor = new Geoprocessor
("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Elevation/ESRI_Elevation_World/GPServer/Viewshed");

Supplying the parameters


The parameters in the Services Directory show the required inputs and outputs of the task. In the
example above, you need to supply all parameters whose Direction
is esriGPParameterDirectionInput and whose Parameter Type is esriGPParameterTypeRequired .
You do not have to supply the output parameters because the output is always returned as an
array of ParameterValue. For instance, the input parameters might look like the following:
var params:Object =
{"Input_Observation_Point":featureSet, "Viewshed_Distance":vsDistance };

Running the task


How you run the task depends on whether the geoprocessing task is synchronous or
asynchronous:

Synchronous executionThe client executes the task and waits for a response before
proceeding. The Supported Operations section of the Services Directory displays 'Execute Task'
for synchronous tasks.
Asynchronous executionThe client submits a job, then verifies that it was successful using a
unique job ID. When the task completes, the client can retrieve the results. The Supported
Operations section of the Services Directory displays 'Submit Job' for asynchronous tasks.

Running a synchronous task

To run a synchronous task, call Geoprocessor.execute(). Supply the input parameters for the task
and optionally include a callback function that tells the application how to handle the results:
gp.execute(params, myFunction);

The results of the task are returned to the callback function as an array ofParameterValue. If
messages are enabled, you also get an array of GPMessage objects.
You can loop through each item in the results array and add it to the map as shown in the
following code:
private function displayResult(event:GeoprocessorEvent):void
{
for each ( var myGraphic:Graphic in event.parameterValues[0].value.features )
{
myGraphic.symbol = viewshedSimpleFill;
myGraphicsLayer.add( myGraphic );
}
}

where viewshedSimpleFill has been defined in MXML as:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


<esri:SimpleFillSymbol id="viewshedSimpleFill" color="0xFF0000" alpha="0.5">
<esri:SimpleLineSymbol color="0x000000" width="1"/>
</esri:SimpleFillSymbol>

Running an asynchronous task

To run an asynchronous task, call Geoprocessor.submitJob(). Supply the input parameters and
optionally specify (1) a complete callback function to be called when the job is successful, and
(2) a status callback function when the geoprocessor checks the job status:
gp.submitJob(params, MyCompleteCallback, myStatusCallback);

The status callback receives a JobInfo object containing the job ID, the job status, and
any GPMessage objects returned by the geoprocessor.

Routing tasks
In this topic

Working with the RouteTask

Optimize the routes

Turn-by-turn directions

Advanced options

Live route samples

Version 3.7

Working with the RouteTask


The typical workflow when working with the RouteTask is as follows:
1.
2.
3.
4.

Create the task


Configure the parameters
Solve the route
Optionally, display the result
Create the task

When you create an instance of RouteTask, you provide a URL that is the REST endpoint to an
ArcGIS Server network analysis service. You can copy and paste the following MXML code
into your application:
<esri:RouteTask
id="routeTask"
url="http://tasks.arcgisonline.com/ArcGIS/rest/services/
NetworkAnalysis/ESRI_Route_NA/NAServer/Route"/>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The equivalent code with ActionScript:


var routeTask:RouteTask = new RouteTask
("http://tasks.arcgisonline.com/ArcGIS/rest/services/
NetworkAnalysis/ESRI_Route_NA/NAServer/Route");

Configure the parameters

To get the desired results from the route task, you need to specify the details of your routing
problem, such as stop locations, barrier locations, the impedance attribute, and so on. You do this
using RouteParameters. The following code example shows how to use RouteParameters to
define two stops for a route using ActionScript only. (See the Route samples at the bottom of this
page for an example of using a combination of MXML and ActionScript.)
var routeParams:RouteParameters = new RouteParameters();
var stop1:Graphic = new Graphic(new MapPoint(-117.21,34.065);
var stop2:Graphic = new Graphic(new MapPoint(-117.185,34.05);
var stops:FeatureSet = new FeatureSet([ stop1, stop2]);
routeParams.stops = stops;

For a complete description of each route parameter, see the RouteParameters entry in the API
reference.
Solve the route

Once you've created the route task and configured its parameters, you can
call RouteTask.solve() to solve the route.
routeTask.solve(routeParams);

In addition to calling the solve method, you need to handle the solveComplete and fault events
on the RouteTask. These functions define what the application will do with the results, whether
the result is a route or an error message.
<esri:RouteParameters
id="routeParams"
solveComplete="solveCompleteHandler(event)"
fault="faultHandler(event)"/>

The equivalent code with ActionScript:


routeTask.addEventListener(RouteEvent.SOLVE_COMPLETE, solveCompleteHandler);
routeTask.addEventListener(FaultEvent.FAULT, faultHandler);

In either case, you'll usually create the actual functions as follows:


private function solveCompleteHandler(event:RouteEvent):void
{
var routeResult:RouteResult = event.routeSolveResult.routeResults[0];
...
}
private function faultHandler(event:FaultEvent):void
{
Alert.show(event.fault.faultString, "Routing Error");
}

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Optimize the routes


The RouteTask can help you find the most efficient path for visiting a given list of stops. This is
sometimes known as the traveling salesperson problem. To solve it,
set RouteParameters.findBestSequence to true and the stops will be visited in the most efficient
order. You can optionally designate whether the first and last stops on the list should remain
fixed.
routeParams.findBestSequence = true;
//routeParams.preserveFirstStop = true;
//routeParams.preserveLastStop = true;

Turn-by-turn directions
The RouteTask can return turn-by-turn driving directions between stops. To get the directions,
set RouteParameters.returnDirections to true.
routeParams.returnDirections = true;

Advanced options

Batch routingSolve multiple routes in one request. Stops with the same name will be grouped
into sets for solving individual routes. For the batch routing result, you'll get an array
of RouteResult containing each route.
Time windowsConstrain stop visits to certain times of day.

Learn more about routing with time windows

Live route samples


The following route samples are available:

Basic RoutingBasic routing example


Routing around barriersUsing barriers to avoid certain locations
Route DirectionsTurn-by-turn driving directions

GeoEnrichment
In this topic

User experience

Infographics

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

InfographicsCarousel

Samples and additional references

Version 3.7
Starting with version 3.5, the ArcGIS API for Flex provides access to the ArcGIS
GeoEnrichment service. This service provides the ability to get facts about a
location or area. Using GeoEnrichment, you can get information about the
people, places, and businesses in a specific area or within a certain distance or
drive time from a location. GeoEnrichment capabilities allow you to answer
questions about locations that you can't answer with maps alone. What kind of
people live here? What do people like to do in this area? What are their habits
and lifestyles? What kind of businesses are in this area?

User experience
The two screen captures below depicts a typical user experience when working with
GeoEnrichment functionality using the ArcGIS API for Flex.

The first step is to click a location on the map to determine your study area and initiate a
GeoEnrichment task.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Next, the geometry of the study area and the infographic are returned.

Infographics
Multiple components fall under the GeoEnrichment umbrella. The Infographic and
InfographicsCarousel are the two main components you will use if working with GeoEnrichment
functionality. After you specify a study area and geometry, either the Infographic or
InfographicsCarousel automatically accesses the GeoEnrichment service where the information
you requested is properly summarized and visualized in tables or/and charts.
These componenst provides a graphic layout with the information about your study area. Three
types of Infographic components are available:
1. One variable - shown below with a custom skin
2. Related variables
3. Tapestry

Variables can be thought of as the types of data you can add and work with using the
GeoEnrichment service. An example of some types of variables could be:

Household income
Family size
Average home value

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Percentage of developed land


Tapestry classification of residents

This is just a small sampling of the many variables you can access when working with
GeoEnrichment functionality. See the Explore GeoEnrichment Data Coverage sample to browse
the variables per country.
One variable Infographic

The screen captures provided in the user experience above displays a OneVar , or 'one variable',
type of Infographic. This type displays the value of single variable. In the example provided, the
variable displayed is 'average household size'.
The code snippet to create this is similar to the following:
<esri:Infographic id="infoGraphic"
width="100%" height="100%"
complete="infoGraphic_completeHandler(event)"
countryId="US"
fault="infoGraphic_faultHandler(event)"
loadStart="infoGraphic_loadStartHandler(event)"
type="OneVar"
//KeyUSFacts is the datacollectionID and AVGHHSZ_CY, the variable.
variableIds="['KeyUSFacts.AVGHHSZ_CY']" />

The Infographic component is created with a specified type and variableId . When working
with the Infographic component, the default URL it defaults to
is https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer . You
can override this default URL with your own endpoint. An example of this may be if working
with an internal Portal for ArcGIS installation.
Note:

In order to access the GeoEnrichment service, you need an ArcGIS Online subscription to either
an Organization plan or a Developer plan.
In addition to the type and variableId , you will also need to set the studyArea property. This is
what defines the location of the point or area that you want to enrich with additional information.
See the 'Study areas' section in the GeoEnrichment service overview topic for additional
information.
In the example shown above the studyArea is determined when the map is clicked or a buffer is
specified. The snippet below was taken from the map's mapClickHandler event.
...
var studyArea:GeometryStudyArea = new GeometryStudyArea();
studyArea.geometry = mapPoint;
studyArea.options = new RingBuffer([1], RingBuffer.MILES);
//GeographyLevel takes in a (countryId, datasetId, and layerId, the last required)
//Admin levels are aliases that correspond to various levels of geography for
each individual country

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


//US: Admin3 (US.Counties), Admin2 (US.States), Admin1 (US.WholeUSA)
studyArea.comparisonGeographyLevels = [
new GeographyLevel(null, null, "Admin3"),
new GeographyLevel(null, null, "Admin2"),
new GeographyLevel(null, null, "Admin1")
];
studyArea.returnGeometry = true;
infoGraphic.studyArea = studyArea;
...

The GeometryStudyArea is created and is set to the geometry of the passed-in mapPoint . In
addition, options is set to the studyArea . These options will be applied to theStudyArea's
geometry to determine the area to enrich. See the StudyArea class' API reference for additional
information.
If the study area's geometry is a MapPoint or a Polyline , the GeoEnrichment service will create
a 1-mile ring buffer around the geometry to collect and append enrichment data. You can
optionally change the ring buffer size or create drive-time service areas around the geometry by
setting the options . In addition to this, there are three types of options you can set:

RingBuffer
DriveBuffer
IntersectingGeographies

See the samples provided in the GeometryStudyArea API reference for further information.
Each country has its own standard geography levels. These geography levels are what gets
passed in to the study
area's comparisonGeographyLevels property. comparisonGeographyLevels allows you to request
data for geography levels that intersect the study area. The Infographic displays the variables for
those levels, this allows you to compare them against the study area variables. Please see
the GeographyLevel API reference for additional information.
Last, the returnGeometry determines whether the geometry of your study area will be returned.
Since we would like to show the study area with the results on map, set it to true .
For the full code used in the snippet above, see the Infographic sample.
Related variables infographic

Another type of infographic is RelatedVariables . This type displays values of multiple variables
and the deviation with the comparison levels.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

For the above sample, all that needed updated were a couple of properties in the Infographic.
First, the Infographic's type property was modified to RelatedVariables . Next,
the variableIds property was updated to reflect multiple variables. In this example, it displays
'Households by Income' for various ranges.
...
type="RelatedVariables"
///HouseholdsByIncome is the datacollectionID for all variables listed
variableIds="[HouseholdsByIncome.HINC0_CY_P,HouseholdsByIncome.HINC15_CY_P,
HouseholdsByIncome.HINC25_CY_P,HouseholdsByIncome.HINC35_CY_P,
HouseholdsByIncome.HINC50_CY_P,HouseholdsByIncome.HINC75_CY_P,
HouseholdsByIncome.HINC100_CY_P,HouseholdsByIncome.HINC150_CY_P,
HouseholdsByIncome.HINC200_CY_P]"/>

Tip:

If you wish to request all the variableIds in a data collection, you can do so using a wildcard (*).
For example, HouseholdsByIncome.* would iterate through all the variables within the
HouseholdsByIncome data collection.
Tapestry infographic

The last type of infographic is Tapestry . Tapestry classifies US neighborhoods into 65 market
segments based on socioeconomic and demographic factors. Please seeLifestyles-Esri Tapestry
Segmentation data for additional information on how this works.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

In this sample, we updated the Infographic's type property to Tapestry and updated
its variableIds to reflect the Tapestry DataCollection's ID.
...
type="Tapestry"
///Tapestry is the datacollectionID and variables defined with a wildcard
variableIds="['Tapestry.*']"/>

InfographicsCarousel
The InfographicsCarousel component requests GeoEnrichment data for a specified location and
visualizes the results in a collection of Infographics. This collection of Infographics can be
scrolled through via its 'next' (right arrow) and 'previous' (left arrow) buttons.
The following screen captures display an InfographicsCarousel that shows both related variables
and tapestry types.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The code used to create the InfographicsCarousel is very similar to what is used when creating
an Infographic.
<esri:InfographicsCarousel id="carousel"
complete="carousel_enrichCompleteHandler(event)"
fault="carousel_faultHandler(event)">

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


<geoEnrichmentClasses:GeometryStudyArea id="geometryStudyArea"
geometry="{inputGeometry}"
options="{bufferOptions.studyAreaOptions}"
returnGeometry="true">
<geoEnrichmentClasses:comparisonGeographyLevels>
<geoEnrichmentClasses:GeographyLevel layerId="Admin3"/>
<geoEnrichmentClasses:GeographyLevel layerId="Admin2"/>
<geoEnrichmentClasses:GeographyLevel layerId="Admin1"/>
</geoEnrichmentClasses:comparisonGeographyLevels>
</geoEnrichmentClasses:GeometryStudyArea>
</esri:InfographicsCarousel>

This code snippet takes user input and returns GeoEnrichment data for a specified area.
The InfographicsCarousel component is declared within the markup. The GeometryStudyArea is
defined with its geometry set to the geometry specified by the user's input. The geography levels
are also set to US: Admin3 (US.Counties), Admin2 (US.States), Admin1 (US.WholeUSA) .
Once the carousel_enrichCompleteHandler event handler is fired, the resulting studyarea 's
geometry is set to the geometry of the graphic layer.
private function carousel_enrichCompleteHandler(event:InfographicEvent):void
{
...
//put the result geometry on the graphics layer
resultGeometry = event.studyAreaGraphics[0].geometry;
//zoom to the geometry
map.extent = resultGeometry.extent;
...
}

For the full code used in the snippet above, see the InfographicsCarousel sample.

Samples and additional references


To test out this functionality, see the samples:

Infographic, this sample illustrates how to work with a simple 'one variable' Infographic with the
option to specify a buffer.
Compare Infographic types, this sample demonstrates how to work
withIntersectingGeographies study area options. It also illustrates smaller skins for the
Infographics. A bar chart is used for the 'one variable' type. This is displayed in the first screen
capture at the top of this page.
InfographicsCarousel, this sample illustrates how to work with the InfographicsCarousel with
buffer options.
InfographicsCarousel custom skin, this sample demonstrates how to work with the
InfographicsCarousel using small and standard skin versions.
Enriching a GeometryStudyArea, this sample allows you to choose a location, and then specify
up to five variables to enrich the chosen location.
Using StandardGeographyQueryTask, this sample describes how to work with
theStandardGeographyQueryTask.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Explore GeoEnrichment Data Coverage, this sample allows you to browse geography levels, data
collections, and variables per country.

The links below provide additional help documentation when working with GeoEnrichment
functionality:

GeoEnrichment Service Overview topic situated in the ArcGIS REST API section Demographic

Developers.arcgis.com - GeoEnrichment
Enriching your data via Esri Maps for Office
Tapestry Segmentation in ArcGIS Online
Blog: Javascript developers meet GeoEnrichment
Infographic component API reference
InfographicsCarousel API component API reference
Supporting classes for the GeoEnrichment components
Supporting classes for the GeoEnrichment service and related tasks

and lifestyle attributes

Introduction to ArcGIS Server


Version 3.7
ArcGIS Server, Esri's primary server geographic information system (GIS)
product, allows you to create and distribute geospatial web services. A complete
and integrated server-based GIS, ArcGIS Server provides out-of-the-box enduser applications and services for spatial data management, visualization, and
spatial analysis.
This Help section contains information to assist you when using the following:

Services Directory

ArcGIS Server services

Secured services

For more information on ArcGIS Server, visit the ArcGIS Server Resource
Center orcontact your local Esri representative. If you already own ArcGIS,
many support resources are available to help you get started and meet your
application needs.

Using the ArcGIS Services Directory


Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

In this topic

Opening the ArcGIS Services Directory

Finding information about a service

Version 3.7
The ArcGIS Services Directory, a component of the ArcGIS Server REST infrastructure,
contains information on the services available at each server.
Search for available services (including secured services, with proper login) and view service
details including the following:

Properties such as spatial extent and supported operations


Layers with links to layer details (Simple queries can also be executed on layers.)
Required input for services, such as the address format for a geocoding service

Opening the ArcGIS Services Directory


To open the ArcGIS Services Directory for an ArcGIS Server machine, you must know the URL
of the server instance. Prior to version 10.1, the ArcGIS Server instance was typically installed in
the web server's root as arcgis, and the ArcGIS Services Directory was in the rest folder inside
the instance. For example, if the server was at www.example.com , the ArcGIS Services Directory
would be located at http://www.example.com/arcgis/rest/services (.NET)
or http://www.example.com:8389/arcgis/rest/services (Java).
The default URL of the server instance changed beginning with version 10.1. Regardless of the
operating system, the default location
is http://www.example.com:6080/arcgis/rest/services for unsecured sites
and http://www.example.com:6443/arcgis/rest/services for secured ones. The Web Adaptor
allows you control over your site URL if you don't want users to see the default port number(s)
or the default site name arcgis. See About the ArcGIS Web Adaptor tppic for additional
information on this topic.
Contact your ArcGIS Server system administrator if you are uncertain about the server URL or
ArcGIS instance.

Finding information about a service


Use the ArcGIS Services Directory to obtain information you need to use in a service with
the ArcGIS API for Flex. Copy the desired service's URL from the address bar in your browser
and paste it in your code. For example, a service in the example server above might have a URL

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

of http://www.example.com/arcgis/rest/services/ExampleService/MapServer . The server type


appended to the end of the URL is required to specify the type of service used.
The directory also allows you to search for layer IDs to identify features within particular layers.
The layer IDs can be found in the Layers list on a map service's properties page. If you need
names of attribute fields to specify the information to return in a query, you can drill down to the
layer's properties to find a list of fields.
Some services may be secured so that only authorized users may access them. Log in to the
ArcGIS Services Directory to see which services you have access to. For more information,
see Secured services.

Using an ArcGIS Server service


In this topic

Using map services

Using other service types

Version 3.7
To use an ArcGIS Server service in the ArcGIS API for Flex, you need to know the URL of the
service. URLs can vary, but often resemble the following:

http://www.example.com/arcgis/rest/services/ExampleService/MapServer

Using map services


You can obtain information about a map service either from your ArcGIS Server administrator or
by searching the ArcGIS Services Directory.
In addition to the service's URL, you may also need further information to use a map service. See
the following:

Map layer IDsThese are necessary if you intend to identify or query on those layers.
Note:

IDs are usually integer values and are not the same as the layer name, which is assigned
by the author of the map.

Names of the attribute fields in a layerThese are needed if you intend to specify which fields
are returned from a query.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Other map informationSuch as the spatial extent of the map or individual layers, the feature
type of a layer (point, line, or polygon), or the minimum and maximum scales at which the layer
displays.

Using other service types


Other services require different information. For example, geocoding services have address
fields that you provide inputs for such as street, city and state, and postal code, to return a result.
Geoprocessing services contain input parameters for which you supply information. These
parameters have certain data types and may or may not be required.
This data can be obtained from the ArcGIS Services Directory associated with the ArcGIS
Server you want to use. In addition, some services may be secured so only authorized users may
access them.

Secured services
In this topic

User versus app logins

OAuth2-based authentication

Token-based authentication

HTTP/Windows authentication

Version 3.7
There are a few ways to handle security when working in applications built with the ArcGIS API
for Flex. Three methods used to manage user and/or app logins are as follows:
1. OAuth2-based authentication
2. Token-based authentication
3. HTTP/Windows-based authentication

These methods can be applied to various platforms, these platforms can be thought of as either:

A secured ArcGIS Server service that works with token-based authentication, or


ArcGIS Online or a Portal for ArcGIS installation and any of its associated services.

User versus app logins


As a developer using the ArcGIS platform, you can build the following two types of
applications:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Applications that target end users of the ArcGIS platform. These applications need to allow users
to login to the platform via the application. These types of logins are known as user logins.
Applications that target end users who are unknown to the ArcGIS platform. These applications
need to login to the platform on behalf of the application. These kinds of logins are known as
app logins.

User logins

User logins are probably the more familar of the two as this is what ArcGIS Server's existing
token-based authentication uses with the generateToken REST API call . If an application tries to
access a secured service, it requires a valid token to unlock the service. For example, a web
application that accesses a secure service can be configured to prompt a user for their user name
and password credentials. This specific end user would need to have permission set with the
platform so that their credentials can unlock this service. This user login is known to the
platform; in this scenario, the platform is a secured ArcGIS Server service.
Managing users and their roles can be handled various ways in ArcGIS Server. Please see
the Configuring ArcGIS Server Security top for additional information regarding how this
works.
App logins

When working with app logins, the application code logs into the platform on behalf of itself.
Simply stated, an application registered with ArcGIS.com can log in regardless of who is
accessing it. This is useful when it is not necessary to have users directly log in to access an
application. This can be the case in circumstances where you may not know all of the end users
accessing the application. You just need to make certain they have access to ArcGIS.com and the
resources within it. You will want to be cognizant of how the application is being used to avoid
any misuse since anyone can access it. This will be discussed further in the OAuth2
authentication section below.

OAuth2-based authentication
Beginning with version 3.5, support for OAuth2 authentication is provided directly in the
ArcGIS for Flex API's Identity Manager. This built-in functionality handles a lot of the finegrained work that you would typically have to do when implementing this type of authentication.
When working with OAuth2 authentication, the platform you work with is ArcGIS Online. If
you have an organizational account, you are able to register applications with this platform.
Please see the Adding items ArcGIS.com help topic for steps on how to do this.
When you register your application you need to add one or more redirect URIs. This is the URI
of the app and the URI to which the token will be returned. Once you register your application
with the platform, you will have an associated application ID (App ID) and application secret
(App Secret). These can be viewed similarly as a user name and password where the App ID is
open to the public and can be seen by everyone whereas the secret is kept confidential, similar to
that of a password.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The screen capture above displays the registered application's ID, type, and redirect URI's.
OAuth2-based authentication and user logins

When working with OAuth2-based authentication you can work with either user or app logins.
Applications that support user logins use OAuth2 to allow end-users to log in to the ArcGIS
platform via a login page. User login is performed in a single step which requires the application
to direct the browser to the OAuth2 authorization URL for the portal, for example arcgis.com.
https://www.arcgis.com/sharing/oauth2/authorize?
client_id = "RRGuEoGwvId9cs0I"&
response_type=token&
redirect_uri = http://resources.arcgis.com

Once the user logs in, the application receives a token that it can use to access the platform on
behalf of the user. The server returns a token by redirecting the browser to the
specified redirect_uri . This token needs to be sent to the platform with all requests.
The default expiration time for the token returned by this approach is two hours. To request an
token that is valid for a longer period provide an expiration time (in minutes) using
the expires parameter. The maximum expiration time set by the platform will override the
expiration time requested by the application.
The Identity Manager component simplifies the process of working with the token by appending
the token in all requests and acquiring a new token when necessary. The OAuthInfo class contains
information regarding the OAuth configuration such as the appID , expiration , locale ,
and portalURL . For additional information on this, see thereference.
For additional information on how to build a user login application, see the ArcGIS.com Web
Map (OAuth) sample that provides the ability to work with the Identify Manager to log-in and
access a web map in ArcGIS Online.
OAuth2-based authentication and app logins

Applications that target end users who are not known to the platform use application (app) logins
to connect to the platform. In this case the application will login to the platform on behalf of

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

itself and its end users will not be prompted for their credentials. Applications that use app logins
must use both the OAuth2 AppID and AppSecret .
Malicious users that gain access to both the AppID and AppSecret can access billable services on
ArcGIS.com, all of this billed to the application. Developers are responsible for keeping
the AppSecret confidential. This implies that the application will need to have a server side
application component that keeps the application credentials secure since client source code can
be inspected.
The server-side application component that has access to the applications credentials can obtain a
token using a single request by making a POST request to the portal's OAuth2 token endpoint
with an OAuth2 grant_type value equal to client_credentials .
http://www.arcgis.com/sharing/oauth2/token?
client_id = "RRGuEoGwvId9cs0I"&
client_secret = "this is where you would enter the app secret"&
grant_type = "client_credentials"

Successful authentication directly returns a JSON response containing the token that allows
access to resources shared with it.
To get a better idea of how a server side component handles the process of storing credentials,
acquiring the token, and appending it to all requests, view the resource proxy on GitHub. You
will also want to review the Using the Proxy Page help topic for details on how to work with the
proxy from an application built with the ArcGIS API for Flex.
View the Infographic or any of the other GeoEnrichment samples for an example of an
application that uses a proxy to store the authentication information. This information is what is
used to access the ArcGIS GeoEnrichment service used in the sample.

Token-based authentication
Token-based authentication services require that a token be included in each request for a map,
query, etc. ArcGIS Server, ArcGIS Online and Portal for ArcGIS all support token-based
authentication via a token service that can be used with both application and user logins. Upon
successful authentication the token service returns a token that needs to be appended to all future
requests.
The request to the token service must be made over HTTPS and all subsequent requests that use
the token also need to be made over HTTPS if required by the resource.
Token-based authentication and user logins

Applications that support user logins are responsible for providing a login dialog that prompts
users for their credentials. The application is responsible for keeping these credentials secure by
transmitting them over HTTPS.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

If you are building an application that accesses resources from ArcGIS Online, Portal for ArcGIS
or services from ArcGIS Server 10.0 SP1 or later the recommended approach is to use the
Identity Manager to handle the process of gathering the credentials and acquiring and using the
token. To use the Identity Manager simply enable the Identity Manager component in your
application.
import com.esri.ags.components.IdentityManager;
IdentityManager.instance.enabled = true;

Token-based authentication and app logins

Applications that access secured resources using token-based authentication can do so via an app
login approach. This occurs when the user does not log in to the application by supplying
credentials. Rather, a generic 'user' will need to be provisioned with a supplied user name and
password. These credentials are then provided when making a request for a token to the token
service.
Developers are responsible for keeping the credentials a secret, including from users who inspect
browser source code using developer tools. This implies that the application will need to have a
server side application component that keeps the application credentials secure.
One way to do this would be via a proxy server-side component. The proxy could be written to
handle storing credentials, acquiring the token, and appending the token to all requests. View
the resource proxy on GitHub for an example.

HTTP/Windows authentication
When a request is made to a service secured with HTTP authentication (including Windows
authentication using IIS), the server issues an authentication challenge. The application or user
must respond with appropriate user credentials using standard HTTP authentication methods.
The two approaches to accessing a secured service using HTTP/Windows authentication are as
follows:

Use server-side code (ASP.NET, JSP, PHP, and so on) to set an identity for the request. The server
sends the request with the identity; the end user does not need to log in. For more information,
see Using the proxy page.
Do not supply any credentials within your application. Instead, let the server challenge the
browser user. The user will see a login dialog box in the browser and must provide a valid user
name and password for the ArcGIS Server system that issued the challenge. Work with your
system administrator to ensure that end users have login information. For additional
information on this, please see the ArcGIS Server help.

Additional Information

If HTTP Basic authentication is used, you should require that users employ HTTPS when
accessing your application to prevent password interception. Other authentication methods,

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

such as Digest or Integrated Windows Authentication, may protect user logins, but for maximum
security, HTTPS is recommended when users are logging in.
Authentication is required only for the initial request to the secure service. This may result in a
user encountering a login dialog box midway through a session. For example, if the user
requests a nonsecure map, then tries to perform a query on a secure server, the login dialog box
will appear only after the query. To avoid this, send a request in the background to the ArcGIS
Server system when the application starts, such as a simple REST request for service
information. The user would be prompted to log in on startup rather than when using the
application.
Supplying end users with a user name and password is not appropriate when services from
more than one ArcGIS Server system are used in an application, as multiple logins would be
required. This limitation does not apply when using multiple services within the same ArcGIS
Server system, since the challenge is issued for the entire server.
The ArcGIS API for Flex supports basic use of secured services from ArcGIS for Server 9.3 and
above. There is no support for ArcIMS secured services.
If you are the administrator of an ArcGIS Server system, you can restrict access to your ArcGIS
web services. Information on restricting access is available in the help documentation for ArcGIS
for Server.
If working in Internet Explorer using client certification authorization, an additional line needs to
be added to the HTML wrapper similar to what is displayed below.
<script type="text/javascript"
src="https://[server]/arcgis/rest/services?f=json&amp;callback=String"></script>

Using the proxy page


In this topic

About the proxy page

Downloading and configuring the proxy page

Adding code to use the proxy page

Testing and deploying the application

Securing the proxy application

Version 3.7

About the proxy page


The proxy page consists of server-side code that runs on your web server. The browser sends the
request to your proxy and your proxy in turn, forwards the request to the ArcGIS Server service.
You may need to use a proxy in the following situations:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The service you are trying to connect to is on a different domain than your application, and the
service does not have a crossdomain file allowing your Flash application access.
The application uses a service that is secured with token-based authentication, and you do not
want to allow users to view the token, or you do not want to transmit the token over the
network between your web server and your users.
You are building an application that targets end users not known to the ArcGIS platform. In this
situation, the application will login to the platform using information stored in the proxy.
View Authentication, OAuth 2.0, and ArcGIS for details.

Note:

For a JavaScript application, a proxy page is also required when the requests exceed the limit on
the length of the uniform resource locators (URLs) imposed by the browser. This does not apply
to Flex API applications as the Adobe Flash Player can "POST" requests when needed.
To use the proxy page, you need to perform the following steps, which are described in detail as
follows:
1.
2.
3.
4.

Download and configure the proxy page appropriate for your server
Add code to your application page to enable use of the proxy
Test to ensure the proxy is working correctly
Secure the proxy application

Downloading and configuring the proxy page


The proxy runs on your local web server, not on an Esri server or on the computer where ArcGIS
Server is installed (unless your web server also hosts the ArcGIS Server instance). Three proxies
are available each targeting a specific server-side platform: ASP.NET, Java/JSP, and
PHP. Download the appropriate proxy for your platform from GitHub. Each proxy download
includes installation instructions and information on system requirements. Make sure you follow
these instructions in order to setup and configure the proxy on your web server.

Adding code to use the proxy page


In order for your application to route requests through the proxy you must add code to your
application to define the location of the proxy. If your proxy page is not in the same directory as
the web application, adjust the path appropriately. The path should use a relative URL (for
example, ../proxy.ashx ), or a URL relative to the root (for example, /Proxy/proxy.ashx ).
<esri:ArcGISDynamicMapServiceLayer
id="treasureMap"
url="http://www.example.com/ArcGIS/rest/services/TreasureMap/MapServer"
proxyURL="URL to proxy"/>

or with ActionScript:
treasureMap.proxyURL = "URL to proxy"
// or with an absolute URL

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


treasureMap.proxyURL = "http://<URL to proxy>"

Testing and deploying the application


Once you have configured the proxy page with the application, test the application to ensure that
requests are processed correctly. The application should function normally as it did before the
proxy page was implemented. If not, you may need to troubleshoot the proxy.

If your application environment supports debugging mode, you may be able to set a breakpoint
in the proxy page and detect whether it is operating correctly.

For example in IIS/ASP.NET environment, you can open the application in Visual Studio
and set a break point in the ProcessRequest method in the proxy.ashx., then run the
application in debug mode. The execution should halt at the breakpoint, and you should
be able to detect where the problem is. You may also set breakpoints in your Flex
application, or insert trace() or Alert() statements to display values during execution.

Set the ProxyConfig mustMatch attribute to false to proxy all requests. If the application works
when this value is set to false then you may not have listed your service in
the serverUrls section or you may have a typo in the serverUrl. Don't forget to set this
attribute back to true when you have finished troubleshooting the proxy.
Enable logging for the proxy. Once enabled messages are written to the log that may be useful
when troubleshooting the issue.
Make sure you've specified the correct location for your proxy in your application code. You can
use browser developer tools to determine if the proxy can be successfully located. To do this,
activate your browser debugging tools then examine the network requests. Look specifically for
requests that POST to the proxy. If you see a 404 error this means that the proxy was not found.
Inspect the request properties to view the path where the application is looking for the proxy.

Securing the proxy application


If the application uses services with token-based security, and the proxy is configured with the
username and password or client_id and client_secret the proxy application needs to be secured
so that only authorized applications have access. ViewAuthentication, OAuth 2.0, and
ArcGIS for additional details.

Deploying an application
In this topic

Adobe Flash Builder setup

Compiling an optimized SWF file

Production workflow

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

About crossdomain.xml

Working with SSL

Deploying crossdomain.xml

Additional information

Version 3.7

Adobe Flash Builder setup


For improved performance, adjust your Adobe Flash Builder settings as follows:

Click Project > Properties > Flex Compiler, then uncheck the Enable integration with
browser navigation check box. Unless you've added code to specifically support deep links,
there is no need for this box to be checked.

Compiling an optimized SWF file


When you compile an application in Adobe Flash Builder, a debug version is created. While
useful for development purposes, this is not optimal for deployments.
When you're ready to deploy an application, use the Adobe Flash Builder Export Release
Build process to create an optimized release-quality version of the SWF file as follows:
1. In Adobe Flash Builder, click Project > Export Release Build from the main menu.
2. Click Finish .
Note:

If working with images, it is important to note that embedded resources do not get exported out
to the release folder. If you wish to reference an image, you will need to make sure that this
image is manually copied in the export build.

Production workflow
The compiled application (SWF file), its HTML wrapper, and its related files (for example,
shared libraries) can be moved onto any web server. There are no dependencies on any additional
files hosted by you (or Esri) at run time, because the compiled SWF file contains all the
necessary code.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

When a web user accesses the HTML wrapper file, the browser verifies that Adobe Flash Player
is installed and is using the specified minimum Flash Player version. The client browser then
downloads the SWF file. At this point, the user might not connect back to this web server at all
but instead connect directly to the servers containing map content and tasks. If your web
application is not hosted on the same server as ArcGIS Server, you must have a crossdomain.xml
file on ArcGIS Server.

About crossdomain.xml
To access data from a server other than the one hosting your Flex application, the remote server
needs to have a cross-domain file in the root directory. For security reasons, the web browser
cannot access data that resides outside the exact web domain where the SWF file originated.
However, Adobe Flash Player can load data across domains if permission is granted from the
server. This is accomplished by including a small crossdomain.xml file on the remote server that
permits Flash to connect to services on that server. See the following code example:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
</cross-domain-policy>

For additional information, see Using cross-domain policy files in the Adobe Flex 3 Help, Adobe
TechNote "External data not accessible outside a Macromedia Flash movie's domain," or view
a sample cross-domain file.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Working with SSL


It is possible to host your Flex web application using Secure Sockets Layer (SSL). Although it is
not required, it is good practice to enable the web server for https rather than http. If this is not an
option, you can modify the crossdomain.xml file similar to what is provided below so that http
can access https without errors.
Set secure="false" to allow http to https transfer
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" secure="false"/>
<site-control permitted-cross-domain-policies="all"/>
<allow-http-request-headers-from domain="*" headers="*"/>
<allow-https-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

Deploying crossdomain.xml
To deploy the cross-domain file on ArcGIS Server, see the instructions below specific to your
platform and version. Note the crossdomain file goes on the server with ArcGIS Server, not the
server with your application.

For 10.1, the location for Windows is C:\Program


Files\ArcGIS\Server\framework\runtime\tomcat\contexts\rootapp .
Note:

ArcGIS 10.1 comes with the crossdomain.xml already installed, so unless you want to
make changes, it should work successfully.

.NETAdd crossdomain.xml to your web server's root directory, for


example, C:\inetpub\wwwroot.
JavaAdd crossdomain.xml
to <ArcGIS_Server_Install_Location>\ArcGIS\java\manager\web_output for
10.0 or <ArcGIS_Server_Install_Location>\ArcGIS\java\web_output for 9.3 installations
of ArcGIS Server.
On Windows, the default locations for these directories are:
10.0 C:\Program Files\ArcGIS\Server\java\manager\web_output
9.3 C:\Program Files\ArcGIS\java\web_output

To deploy the cross-domain file on ArcGIS Spatial Data Server, see the following instructions
specific to your platform and version:

ArcGIS 10.1 Spatial Data Server for the Java Platform installs the client access policy files in the
Java installation directory (for example, C:\Program Files\ArcGIS\SDS10.1\java). Copy the
crossdomain.xml file to your web server's root directory. For example:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

If you use Apache Tomcat, place the appropriate client access policy file
in $CATALINA_HOME/webapps/ROOT (Linux) or
%CATALINA_HOME%\webapps\ROOT (Windows) prior to deploying.
If you use IBM WebSphere or Oracle WebLogic, create a .war file that contains the
appropriate client access policy file and deploy it to the web server's root directory.
For ArcGIS 10.1 Spatial Data Server for IIS, install the Cross-domain Policy Files when you run the
installation wizard. This installs the crossdomain.xml file in the web server root location.

Additional information
Please see the crossdomain.xml for additional information specific to crossdomains.

Using crossdomain.xml
In this topic

About using crossdomain.xml

Working with SSL

Deploying crossdomain.xml

Version 3.7

About using crossdomain.xml


Deploying your application

To access data from a different server other than the one hosting your Flex application, the
remote server needs to have a cross-domain file in the root directory. For security reasons, the
web browser cannot access data that resides outside the exact domain where the Shockwave
Flash (SWF) file originated. However, Adobe Flash Player can load data across domains if
permission is granted from the server. This is accomplished by including a small
crossdomain.xml file on the remote server that permits Flash to connect to services on that
server. See the following code example:
Sample crossdomain.xml file
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
</cross-domain-policy>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Working with SSL


It is possible to host your Flex web application using Secure Sockets Layer (SSL). Although it is
not required, it is good practice to enable the web server for https rather than http. If this is not an
option, you can modify the crossdomain.xml file similar to what is provided below so that http
can access https without errors.
Set secure="false" to allow http to https transfer
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" secure="false"/>
<site-control permitted-cross-domain-policies="all"/>
<allow-http-request-headers-from domain="*" headers="*"/>
<allow-https-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

Deploying crossdomain.xml
To deploy the cross-domain file on ArcGIS Server, see the instructions specific for your platform
and version.

.NETAdd crossdomain.xml to your web server's root directory, for example,


C:\inetpub\wwwroot.
JavaAdd crossdomain.xml to
<ArcGIS_Server_Install_Location>\ArcGIS\java\manager\web_output for 10.0 or
<ArcGIS_Server_Install_Location>\ArcGIS\java\web_output for 9.3 installations of ArcGIS
Server. On Windows, the default locations for these directories are as follows:
9.3C:\Program Files\ArcGIS\java\web_output
10.0C:\Program Files\ArcGIS\Server\java\manager\web_output
For 10.1, the location is C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\contexts\rootapp.
Note that 10.1 comes with crossdomain.xml already installed, so unless you want to make changes, it
should work successfully.

For additional information, read:

Restricting cross-domain requests to ArcGIS Server


Cross-domain policy file specification
Cross-domain policy for Flash movies
sample cross-domain file

Debugging tips
Version 3.7

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Use the following tips, including Flex code and calls to the server, to debug
your ArcGIS API for Flex application.
Checking the problem view
When compiling your application in Adobe Flash Builder, note the messages on
the Problems tab located below your code.

Using the trace() function


You can add trace calls to output comments with text and variables to
the Console tab. Note that the trace() function only initiates when running in the
debug mode.

Using TraceTarget
Use TraceTarget as an alternative to multiple trace() calls. To use TraceTarget,
add <mx:TraceTarget/> to your code, then debug the application in Flash Builder
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

(press F11 or click the debug icon

). All network interactions will appear in

the Console tab, allowing you to listen for traffic between your Flex application
and a server. This is especially helpful when working with a server task (for
example, the geoprocessing task).
See the Adobe site for more information on TraceTarget.
Using the debug version of Flash Player
Ensure you have the debug version of Flash Player installed. Right-click
anywhere in a Flash application and verify that Show Redraw
Regions and debugger appear in the list.

To debug your application, first set breakpoints in your code. The debugger will
stop executing the application at those specific points, and you can then inspect
variables and step through the code one line at a time.
You can also take advantage of the debug functionality in Adobe Flash Builder.
Click the Debug button (to the right of the Run button) or press F11. When in
debug mode, Flash Builder will append ?debug=true to the URL.
For more information, go
tohttp://learn.adobe.com/wiki/display/Flex/3g.+Debug+your+applicationand follow
thetutorial and video links.
Monitoring web traffic
If your application compiles but the maps and tasks are not working, use an
HTTP monitoring tool to watch the interaction with ArcGIS Server tasks and
services and other external requests. For instance, use the HttpFox extension in
Firefox or a cross-browser monitoring tool such as Charles Web Debugging
Proxy.
Note that all communication with ArcGIS Server uses the REST API, so there are
many open-source solutions available to view requests (headers and
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

parameters) and responses. This is especially helpful when working with tasks.
For example, you can take the request from HttpFox or Charles and directly
manipulate the variables in the browser.
When finished debugging, don't forget to close your debugging session by either
closing the browser or pressing the Terminate button in the Console view.

What's new in ArcGIS API for Flex


In this topic

ArcGIS API 3.7 for Flex

ArcGIS API 3.6 for Flex

ArcGIS API 3.5 for Flex

ArcGIS API 3.4 for Flex

ArcGIS API 3.3 for Flex

ArcGIS API 3.2 for Flex

ArcGIS API 3.1 for Flex

ArcGIS API 3.0 (final) for Flex

ArcGIS API 3.0 (prerelease) for Flex

Previous versions

Version 3.7

ArcGIS API 3.7 for Flex


The following enhancements and bug fixes are new at version 3.7 which was released in
November 2014:
Enhancements

Exposed the supportsOAuth property in PortalInfo .


Now displays level "19" of OpenStreetMap data.
Added dynamic attribution support for the Ocean basemap service.
IdentityManager.instance.setCredentialForCurrentSignIn(null) will now close any

existing sign-in views.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Bug fixes

NIM099505 - Fixed an issue where the Attribute Table didn't show the domain from the feature
type.
NIM102867 - Corrected the problem where binding directions options fails; however, using
action script to create and set direction options succeeds.
NIM101995 - The style specified in the InfoWindow label is now honored in the sample
application.
NIM102756 - Fixed an issue where legend labels did not print. This was handled by including the
Name property for dynamic layers.
Fixed and issue where unable to print image services secured using tokens.

ArcGIS API 3.6 for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.6 which
was released in December 2013:
Enhancements

NIM092242 - Can now specify hyperlinks for fields with URLs in the 'Show related records' popup.
GeoEnrichment specific: add default property metadata on intersectingGeographics.
Added refreshInterval property to Layer class. This allows you to specify a refresh interval of
the layer in minutes.
Added support for the refreshInterval property in the WebMapUtil class.
Added the ability to customize map tips when using the Draw tool. Seven properties were added
to the Draw tool to aid in
this: toolTipMultipointEnd,toolTipMultipointStart, toolTipPoint, toolTipPolyContinue, toolTipPol
yEnd,toolTipPolyStart, and toolTipStartAndLetGo.
Exposed AttributeInspector.showFeature to simply display an attribute of a feature.
Discussion forum post- If working with hyperlinks in a custom pop-up desciption, you can specify
a target attribute. By default, if no target is set, the link will open up in a new window or tab.

Bug fixes

Addressed issue where Portal's self request did not


honor requestTimeout nor showBusyCursor .
AttachmentInspector: Improve readability of attachment names when multiple attachments.
See GitHub/178.
Fixed an issue where calling AttributeTable.refresh multiple times within a timer caused a
memory leak.
Fixed the issue where ArcGISDynamicMapServiceLayer and
ArcGISTiledMapServiceLayer's showInLegendHiddenLayers property would not work on group
layers. [Requires Server version 10.2.1.]
NIM096289 - Can now work with multiple overlaying transparent fill symbols without obscuring
the layer underneath. Related to Viewer issue GitHub/221.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Fixed incorrect error message while signing into ArcGIS Portal - GitHub/95.
Fixed an issue where the ExportWebMap geoprocessing task sets default server side selection
color when SelectionColor is set to NaN .
GeoEnrichmentTask.createReport now uses a proxyURL if set.
Fixed an issue where InfoWindow draggable content could not be dragged if it was defined in
MXML.

ArcGIS API 3.5 for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.5 which
was released in September 2013:
Enhancements

Added GeoEnrichment capabilities - Using GeoEnrichment, you can get information about the
people, places, and businesses in a specific area or within a certain distance or drive time from a
location. You can also use the GeoEnrichment service to obtain additional geographic context
(for example, the ZIP Code of a location) and geographic boundaries (for example, the geometry
for a drive-time service area). Read more at here and the API Reference
for GeoEnrichmentTask and Infographic. See theGeoEnrichment samples.
IdentityManager support for OAuth when accessing ArcGIS Online for Organizations. One new
class, OAuthInfo, three new methods (findOAuthInfo(), registerOAuthInfos() and signOut() ) and
four new IdentityManager events. (showOAuthLauncher, showOAuthWebView, signIn and
signOut). See the ArcGIS.com Web Map using OAuthsample.
Support for a new locale, Finnish (fi_FI).
New property, EditTool.autoMoveGraphicToTop, that when true (the default) moves selected
graphics to the top of the stack within the parent graphics layer. [See forum post]

Changes to be aware of when migrating from 3.4 to 3.5

If you are using OAuth based on the standalone OAuth sample, you might want to look at taking
advantage of the built-in OAuth workflow available with the new updated IdentityManager.
Bug fixes

NIM093532 - "The legend is not updated in ArcGIS API for Flex application when a renderer is
changed after the map is loaded and a layer is not visible."
The Directions component no longer displays a "Sign in aborted" message under "More info" if
user cancels the sign in window when prompted to log in.
No more glow filter crashes when zooming in quickly on selected lines or polygons.
See https://github.com/Esri/arcgis-viewer-flex/issues/78.
No more MapImageLayer (used by KML Layer or a custom overlay) crashes. [See forum post]
Allow complete refreshing of KML and GeoRSS Layers. [See forum post]
CompositeSymbol: a runtime error was thrown when using CompositeSymbol for polygons and
if the CompositeSymbol included a SimpleMarkerSymbol.
AttachmentInspector: Improve readability of attachment names when multiple attachments.
See https://github.com/Esri/arcgis-viewer-flex/issues/178

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

AttributeTable doesn't refresh non-spatial feature layers after an update operation.


Seehttps://github.com/Esri/arcgis-viewer-flex/issues/166
AttributeTable: properly display coded values of 0.
EditTool: prevent info window renderers from being opened while editing (and make EditTool
more consistent with DrawTool).
Network links within a KML layer should use same serviceURL as the KML Layer.
The createSwatch() wasn't working for PictureFillSymbol if the source was a URL.
Decimal separator for Estonian, Latvian, Lithuanian, Polish and Russian wasn't working when
editing/validating numbers. Bug was specific to version 3.4.
Runtime error when performing an "undo" during editing. Bug was specific to version 3.4.
[See forum post]
PictureMarkerSymbols, based on URL source, when used as part of a CompositeSymbol only
worked when wraparound was true. [See forum post]
TimeSlider tooltip was not localized.
CompositeSymbol doesn't redraw on children symbols changes. Bug was specific to versions 3.13.4 [See forum post]
Allow the "url" property of a layer to be set to null. Especially needed for
ArcGISTiledMapServiceLayer since it got a default value for the url property as of version 3.1.
AttributeTable's "export to CSV" exports unformatted values. Bug was specific to version 3.4.

ArcGIS API 3.4 for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.4 which
was released in July 2013:
Enhancements

Legend support for WMS and ArcGIS Image Server. Simplified LegendSkin. New property:
LegendItemInfo.imageURL for WMS legend URLs. New methods,
ArcGISImageServiceLayer.getLegendInfos() and WMSLayer.getLegendInfos() since these now
implement ILegendSupport interface.
Support for required fields using the new FieldInspector.required property or if it is non-nullable
fields in the service. Support for setting custom renderer for read-only properties.
FieldInspector.rendererIsEditor indicates that the same component is used for both read and
edit scenarios. New method AttributeInspector.validate() to trigger the validation of the form.
New AttributeInspector.isValid property if validation has passed for the form.
Data validation on the client side. Support for data validation when editing attributes using
DoubleField.fractionalDigits property. See the DoubleField.as file in the
/src/com/esri/ags/skins/fieldClasses folder inside the downloaded API zip file.
Date formatting can be customized using CalendarField.dateFormat and useUTC.
The AttributeInspectorSkin now defines the components used for editing of fields. You can take
advantage of the new interface classes to create mobile friendly
skin:ICodedValueDomainField, IDateField, IDoubleField, IFieldRenderer, ILabelField andITypeFiel
d.
New property for CSVLayer to specify the CSVLayer.portalURL, to be used for creating the CSV
layer. Similar to the serviceURL for KMLLayer.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

New property noDataInterpretation on both ImageServiceParameters and


ArcGISImageServiceLayer classes.
New property useStandardizedQueries on both LayerDetails and TableDetails classes. Requires
ArcGIS 10.2 or later.
New print property, PrintParameters.outScale, for printing at an exact scale.
New property rasterFunctionInfos on ArcGISImageServiceLayer and a new
class,RasterFunctionInfo.
New RelationshipInspector.clear() method, similar to AttachmentInspector, to clear the state.
Touch: when only making a small pinch, it now zooms instead of snapping back to nearest level.
The API download (the zip file) includes the localized properties files in addition to the API
Library and skins.
Support for Portal for ArcGIS 10.2, including federated servers with windows authentication.

Changes to be aware of when migrating from 3.3 to 3.4

If you have custom skins for AttributeInspector and RelationShipInspector, they will need to be
updated.
Mobile: consider create a customized version of the updated AttributeInspectorSkin using nonmx components to replace DateField and MemoField.
Bug fixes

NIM091075 - Only show the top VGroup of the PopUpRendererSkin if it's not empty. Reported
as "If a title is not defined in the general popup properties, media popups will not display
properly."
NIM092226 - ArcGISLocalTiledLayer wasn't working for TPK created from non-default "Layers"
dataframe name.
NIM089381 - Add option within Edit Widget to adjust date field format, similar to the date field
format within the popup configuration. This takes advantage of the ability to set dateFormat on
the date components used by AttributeInspector.
NIM076665 - More obvious snapping difference between node and vertex snapping.
Improved snapping for nodes on a line.
Relationship inspector bug fixes
DrawTool for multipoint geometries work again.
For non-point data, the SimpleMarkerSymbol and PictureMarkerSymbol now work again inside a
CompositeSymbol.
The long date format for Arabic and Italian displays correctly.
The InfoWindow styles that were added in version 3.1 are now documented:
headerPaddingBottom, headerPaddingLeft, headerPaddingRight and headerPaddingTop.

ArcGIS API 3.3 for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.3 which
was released in April 2013:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Enhancements

Direction improvements: updated skin with added user options for optimizing route and return
to start. The routing service URL now defaults to
http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World.
New AttributeTable.exportColumnDelimiter property to support custom CSV delimiters.
New GeocoderLocatorOptions.minScale property, to specify when the search should be based
on the center of current map extent.
New PortalInfo.helperServices property, that includes the default printing service, geocoding
service etc when using an ArcGIS Organization or Portal for ArcGIS.
The default for the doNotLocateOnRestrictedElements property on ClosestFacilityParameters,
RouteParameters and ServiceAreaParameters have changed from false to true.
Updated localization for Hebrew and several other locales.
Better support for Portal for ArcGIS and hosted organizations.

Changes to be aware of when migrating from 3.2 to 3.3

The results of the Geocoder should be better since the map extent (technically, map center and a
distance) is only used when zoomed in past 1:150,000.
Bug fixes

NIM090192 - The geoprocessing widget configured in Flex Viewer 3.2 prompts for credentials
although the geoprocessing service has not been secured.
NIM087793 - Certain WMTS (Web Map Tile Service) layer fails to load with ArcGIS API for Flex.
NIM089743 - Longer field values in a relate are cut off in the popups.
NIM090226 - Directions widget showed "Unknown" image for certain direction types.
NIM090234 - Directions widget showed incorrect images for "Bear left, then right" and "Bear
right, then left" directions.
NIM090362- Show related records for map service layers with ID of 10 or higher not working.
Legend component not honoring scale dependency for ArcGIS 10.0 and earlier map services.
Allow horizontal scrolling in AttributeInspector and its RelationshipInspector.
Updated LegendSkin to prevent runtime errors when parentLayerId is null.
AttributeTable now properly honors column order when columnsOrder="fieldInspector".
AttributeInspector fix for when skin changes.
Directions widget - clicking "Directions" with no search strings removed point markers but not
the line from previous directions.
Support more WMTS services: There is now a certain tolerance for matching scales in LODs that
aren't 100% identical.
Better support for Web maps created using ArcGIS Explorer Online.
The generalization/rounding of the screen coordinates for lines and symbols have been
improved.

ArcGIS API 3.2 for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.2 which
was released in March 2013:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Enhancements

Six new locales: Danish, Estonian, Hebrew, Latvian, Lithuanian and Portuguese (Portugal) - for a
total of 22 supported locales.
New Geocoder component - a ready to use component for searching for locations and/or
features. Supports both layers and tables. New related classes: GeocoderEvent,
GeocoderLocatorOptions, GeocoderMapService, GeocoderSearchResult and GeocoderSkin. See
the Geocoder sample.
New Directions (routing) component - a ready to use component for creating driving directions
in your application. You can either type in an address or a feature (see Geocoder above) or click
on the map to add new stops. Adding a destination by clicking on the map will automatically
reverse geocode to get a nice address label. New related classes: DirectionsEvent,
DirectionsGeocoderOptions, DirectionsRouteOptions, DirectionsSkin, DirectionsStop and
DirectionsStopSkin. See the Directions sample.
New CallResponder class that helps manage results for asynchronous calls.
New property AddressToLocationsParameters.sourceCountry to use with the World Geocoding
Service on geocode.arcgis.com.
New property LOD.levelValue to help create correct tile URLs.
New property RouteParameters.directionsOutputType to specify content and verbosity of the
returned directions.
New properties on GeoRSSLayer to set different symbols based on geometry type: pointSymbol,
polylineSymbol and polygonSymbol.
New property showInLegend on Layer and LayerLegendInfo classes.
New property showInLegendHiddenLayers on ArcGISDynamicMapServiceLayer and
ArcGISTiledMapServiceLayer to specify which sublayers should not be shown in the legend.
Automatic attribution (copyrights) that change based on current extent, added for World
Imagery, World Street and Ocean basemap.
WebMapUtil updated to support showLegend, web tiled layers (included WMTS layers
converted to web tiled layers), GeoRSS layers and getting the Bing key from the portal
organization if the bingMapsKey is not set.
Samples
Samples available from GitHub: fork it or just download the zip.
Samples for new components: Geocoder sample and Directions sample.
OAuth sample showing how to sign in to the ArcGIS Platform.
Detailed list of changes to samples since last version:https://github.com/Esri/arcgissamples-flex/issues?labels=verified&milestone=1&state=closed

Changes to be aware of when migrating from 3.1 to 3.2

If you are already using CallResponder, you might have to update your code.

Bug fixes

NIM088718 - Player can crash when a popup is highlighting a line and the user zooms in on the
line. [See forum post and forum post]
NIM089615 - The Flex Viewer Edit widget does not recognize numbers with more than two
decimal places, regardless of the level of precision set on the field

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

NIM089064 - Editor widget does not display attribute window properly after editing overlapping
features
NIM087717 - AIR application with ArcGISLocalTiledLayer does not show TPKs at larger
scales(such as 1:2500 or 1:1000).
NIM087691 - If wrapAround180 = true and the projection doesn't support wrapAround180, RTE
are thrown because the wrapAround isn't set back to false.

ArcGIS API 3.1 for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.1 which
was released in December 2012:
Enhancements

New AttributeTable component - an interactive editable data table for feature layers and tables.
Aside from providing a tabular display of the layer's data, graphics can be selected, deselected,
and zoomed to by interacting with the AttributeTable. If the layer is editable, the feature
attributes will be editable and it will support domains and subtypes as defined by the Feature
Service. New related classes: AttributeTableColumn, AttributeTableEvent and
AttributeTableSkin. See theAttributeTable sample.
Better support for related records using the new RelationshipInspector component. New related
classes: RelationshipInspectorAttributeInspectorSkin, RelationshipInspectorEvent and
RelationshipInspectorSkin. See the Relationship Inspector sample.
MobileArcGISLocalTiled: Support for Esri tile package (.tpk) in mobile applications ArcGISLocalTiledLayer class.
Automatic attribution (copyrights) at bottom right of map. Can be turned off
withMap.attributionVisible. Three new related classes Attribution, AttributionSkin and
IAttributionSupport.
Support for rotating maps. New properties: Map.mapRotation,
Map.middleButtonRotationEnabled, Map.multiTouchRotationEnabled and
Layer.rotatedMapExtent. [NIM051617]. See the Map rotation sample.
InfoWindow (pop-up windows) changes:
InfoWindow auto-anchoring includes right, left, bottom, and top.
InfoWindow now defaults to a RIGHT anchor.
InfoWindow is draggable. This allows you to drag the InfoWindow to see what's under
it, and also dock it to a different side of the feature.
New layer types:
New WebTiledLayer to support adding non-ArcGIS Server map tiles as a layer to the
map. See the new WebTiledLayer sample.
New CSVLayer to support CSV specified by URL. See the new CSV Layer sample.
New GeoRSSLayer to support GeoRSS feeds. See updated GeoRSS sample.
WMTSLayer supports proxyURL properly.
ArcGISTiledMapServiceLayer url property now defaults
tohttp://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer.
Map enhancements
New Map.zoomTo() method easily zoom to a feature.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

New center property to easily center map. Use this with the level property to start the
map at a specific center and level.
The default cyan highlight color for the graphic of the current popup window can be
changed using the new Map.infoWindowRendererHighlightColor style on the Map
component. Set to NaN to not highlight the selected feature. [NIM073051]
Support for CSV by reference layers found in web maps.
Ability to retrieve distinct values from a layer using the Query.returnDistinctValues property. Requires,
at a minimum, ArcGIS 10.1 sp1, and a service that has been published with support for advanced
queries.
Symbol changes:
Support for wraparound for custom symbols. Developers can
useSymbol.getWrapAroundGeometries() in the draw function of their custom symbol to
retrieve the geometry on multiple worlds, and then proceed as before. [NIM064744]
Improved performance for most symbols.
New MapMouseEvent.originalTarget property makes it easier to find out the orginal target (e.g. which
layer) was clicked. [forum post]
Additional styles for the ContentNavigator: headerPaddingBottom, headerPaddingLeft,
headerPaddingRight and headerPaddingTop.
New DrawEvent drawUpdate event on the DrawTool that is fired while drawing, and when the geometry
of the feature is updated. This is useful if you want to display dynamic measurements while a feature is
being drawn.
FeatureLayer changes:
FeatureLayer: Clear the existing selection when added to a Map if the Map's spatial
reference is different than the spatial reference of the layer.
FeatureLayer: Set the selectionColor to NaN to turn off the highlight ("selectionColor").
New FeatureLayer.selectionSymbol property to use a symbol instead of, or in addition
to, the default behavior of highlighting the selected features with a glow using
selectionColor. [NIM073051]
New FeatureLayer queryLimitExceeded event that is dispatched when the feature layer
query hit the maxRecordCount limitation. Requires ArcGIS 10.1 or later.
Samples
All samples have been updated with more comments and description.
Samples have been updated to use the locator
service:http://geocode.arcgis.com/ArcGIS/rest/services/World/GeocodeServer.
Mobile samples have been updated to work better on different type of devices.
New samples
Add new workflows to an application with a tabular view of your data - The new
AttributeTable component can provide new ways to allow your users to interact
with data to view and edit information.
Display pop-ups interactively - This sample shows one approach to provide
programmatic access to display information in pop-up windows or by clicking on
the map.
Weighted Heatmaps - Configure heat maps using functions to control density
radius of the heatmap and index colors from the heatmap gradient used with its
color palette.
View features with related records - Use the new RelationshipInspector
component to display/inspect features that have related records.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Editing features with related records - Use the new RelationshipInspector


component to make edits to features with related records.
Create custom symbols supporting multiple worlds - This sample shows the
steps necessary to create custom symbols which support
map.wrapAround180="true" or duplicate displaying the geometry and symbol in
multiple worlds.
Use tabular information in CSV files as map layers - Use the new CSVLayer class
to create map layers from comma separated values files.
Add content to your map using standard web mapping tiled layers - Use the new
WebTiledLayer class to add services from standard web mapping tiled layer
sources from the web.
Create a map by joining attributes in a table to features in a layer - Join a
dynamic table's attributes to a layer's feature and attributes in a map service to
create a thematic map using the dynamic tables information.
Query a layer by joining attributes in a table to features in a layer - Perform a
query on a map service joining information server-side from a states layer to a
business table with ancestry information from a dynamic workspace.
Explore ways to set the area of interest for your map - Use this sample to learn
the ways you can use geographic (lat/lon) or web mercator map extents or a
map location to set the area of interest for application.
Query for statistics (advanced) sample - Querying for statistics now supports a
geometry filter [requires ArcGIS 10.1 sp1 or higher].
Enable map rotation in your web and mobile application - The Map class now
supports rotation, and includes sample components (web and mobile) to
provide an interactive user experience.
Display features from a dynamic layer using FeatureLayer - Demonstrates how
to view features client-side from a server-side dynamic layer using the
FeatureLayer's source property.
Explore the ability to generate labels interactively - Use this sample to learn how
to create labels for features on the server-side using the new dynamic labeling
features in ArcGIS 10.1 or higher.

Changes to be aware of when migrating from 3.0 to 3.1

The default AttributeInspector.singleToMultilineThreshold property has increased from 40 to 50


to better align with the default length (50) for strings fields created in ArcMap.
Mobile: the default panEasingFactor has changed for mobile applications to give a better "feel"
when panning or "throwing" the map.
There is a known-limit when working with pop-up windows in mobile applications created with
version 3.1. If doing so, please note that you will need to either:
add both mx.swc and sparkskins.swc to your project, or
update the PopUpRendererSkin class and remove references to the RelationshipInspector
component.
The ArcGISTiledMapServiceLayer.url defaults to .
Property changes:
The copyright property has moved to Layer, instead of being on some of the *Layer(s)
which now inherits it from Layer.copyright instead. This affects

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

ArcGISDynamicMapServiceLayer.copyright, ArcGISImageServiceLayer.copyright,
ArcGISTiledMapServiceLayer.copyright and WMTSLayer.copyright.
The ownershipBasedAccessControlForFeatures property on FeatureLayerDetails is now
inherited from LayerDetails.ownershipBasedAccessControlForFeatures.
The ownershipBasedAccessControlForFeatures property on FeatureTableDetails is now
inherited from TableDetails.ownershipBasedAccessControlForFeatures.

Bug fixes

Identify operation on pre-10.1 servers was sometime ignoring the spatial reference.
Swatches for non-solid lines were not honoring color, alpha and width (but the actual feature
rendering was still correct).[NIM081300]
On mobile devices InfoWindow was flickering when panning.
The SignInWindow is more mobile and tablet friendly. [NIM085020]

ArcGIS API 3.0 (final) for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.0 which
was released in June 2012:
Functionality

Connect to ArcGIS Online and Portal for ArcGIS by taking advantage of the ArcGIS Portal API.
Requires Adobe Flex 4.6 SDK or higher, which in turn requires at least Flash Player 11.1.

Enhancements

Since 2.5, 63 new classes, 138 properties on existing classes, and 57 methods on existing classes
have been added to support new API functionality and support for ArcGIS 10.1 functionality,
ArcGIS Online, and Portal for ArcGIS.
Using panEasingFactor in mobile samples for better panning on mobile devices.

Changes

The webmap package has been renamed to portal and includes new class for connecting to
ArcGIS Online and Portal for ArcGIS.
The arcgisSharingURL property in WebMapUtil has been renamed to portalURL .
The default value for Map.openHandCursorVisible has changed from true to false.
On the GeometryServicethe input parameter for the project() method is now projectParameters
instead of geometries. This also allows for specifying datum transformations [requires ArcGIS
Server 10.1].
On the Locator the input parameter for the addressToLocation() method is now
addressToLocationParameters instead of address, outfields. This also adds support for batch
geocoding and searching within an extent [requires ArcGIS Server 10.1].

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The layerDefinitions property on ArcGISDynamicMapServiceLayer, FindParameters and


IdentifyParameters can now take LayerDefinition in addition to a string. When using MXML, only
LayerDefinition is allowed. When using ActionScript, both ways are allowed.
The default value for the UniqueValueRenderer.fieldDelimiter (formerly
UniqueValueRenderer.attributeDelimiter) has changed from "" (empty string) to "," (comma)
and "" is no longer a valid value.
The TextSymbol constructor now takes an alpha value as its 4th parameter. If you were using
the TextSymbol constructor with more than three parameters, you need to adjust accordingly.
The default for the visibleLayers property on ArcGISDynamicMapServiceLayer and
ArcIMSMapServiceLayer changed to null.

Bug fixes

Numerous bug fixes were made for 3.0 final.

ArcGIS API 3.0 (prerelease) for Flex


The following functionality, enhancements, changes, and bug fixes are new at version 3.0
prerelease:
Functionality

Requires Adobe Flex 4.5 SDK or higher, which in turn requires at least Flash Player 10.2.
Support for new ArcGIS for Server 10.1 capabilities
Change renderers or layer order in map services (dynamic layers).
Add layers on the fly in map services (dynamic workspaces).
Generate data classifications on the server for layers in map services.
Use enhanced query options to order results and generate statistics.
Rollback a group of edits if one of them fails.
Editor tracking in feature services.
Use the new PrintTask to generate printable output on the server.
z/m value support in map and feature services.
Geodatabase versions.
Cancel geoprocessing jobs.
An IdentityManager that automatically prompts the end user for logging in to secure ArcGIS Server.
The pop-up window displays with multiple features (using the ContentNavigator class).
When drawing freehand lines or polygons, the point interval (and thus the number of vertices) can be
adjusted.
KML layer supports refresh and httpquery.
Better locale support for VETiledLayer (Bing Maps).
Enhancements

The toJSON() and fromJSON() methods work with objects, not strings.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Changes

The Domain class is now an interface and has been renamed to IDomain.
The JSON class has been renamed JSONUtil, which is the same naming convention as for all the
other classes in the utils package, and it also prevents collision with the JSON class added in
Adobe Flash Player 11.
The Renderer class implements the new IRenderer interface.
The id property in LayerInfo has been renamed to layerId.
The attribute , attribute2 , attribute3 , and attributeDelimiter properties that were
deprecated at 2.5 have been removed at 3.0. Use field , field2 , field3 ,
and fieldDelimiter instead.
The default value for the UniqueValueRenderer.fieldDelimiter (formerly
UniqueValueRenderer.attributeDelimiter) have changed from "" to ",".
The attribute property on the ClassBreaksRenderer class has been renamed to field .
The defaultVisibleLayers() method has been removed. Setting the visibleLayers property on
ArcGISDynamicMapServiceLayer and ArcIMSMapServiceLayer to null will achieve the same
result.
Removed the following deprecated properties: ArcGISTiledMapServiceLayer.visibleLayers,
VEAddress.postalTown, VEGeocodeResult.calculationMethod, and
VEGeocodeResult.matchCodes.
Removed the following deprecated methods: FeatureSet.convertToJSON(),
FeatureSet.convertFromJSON(), and NavigationToolzoomToFullExtent().
Removed the following deprecated event: AttachmentInspector result event.
Removed the unit property from the Map and Layer classes. This is now automatically inferred
from the spatial reference.
The default value for the visibleLayers property on ArcGISDynamicMapServiceLayer and
ArcIMSMapServiceLayer have changed to null. Previously they defaulted to the visible layers as
defined by the default visibility in LayerInfo.
The ClassBreaksRenderer has a new property, isMaxInclusive , that defaults to true to align
with ArcGIS for Server, which is always inclusive. Previously, the behavior was to not be
inclusive.

Caution:

If you're upgrading an application from version 2.5 to 3.x, be sure to readMigrating from 2.5 to
3.x.
For most functionality (for example, basic mapping and query), ArcGIS Server 9.3 or later is
more than adequate. For editing, time-aware layers, closest facility, and service area, the ArcGIS
API for Flex 2.0 (or later) and ArcGIS Server 10.0 (or later) are required. For PrintTask,
dynamic layers, and dynamic workspaces, the ArcGIS API 3.0 for Flex (or later) and ArcGIS for
Server 10.1 (or later) are required. Seesystem requirements for more details.

Previous versions
See What was new in 2.x and What was new in 1.x.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Migrating from 2.5 to 3.0


In this topic

Requirements

Upgrading your Flex API application code from 2.5 to 3.0

Version 3.7
This topic contains the following information to successfully migrate from 2.5 to 3.0:

Requirements
Upgrading your Flex API application code from 2.5 to 3.0

Requirements
The following requirements have changed at 3.0:
Adobe Flex SDK 4.6 or later

As of version 3.0 of the ArcGIS API for Flex, the minimum Adobe Flex software development
kit (SDK) version is 4.6. For earlier versions, 2.x will work with any Adobe Flex SDK 4.0 or
later, while 1.x will work with Adobe Flex SDK 3.x.
Flash Player 11.1 or later

As part of the move to Flex 4.6 SDK, Flash Player 11.1 or later is now required.

Upgrading your Flex API application code from 2.5 to 3.0


The information in this section is to ensure that your ArcGIS API 2.5 for Flex code works with
ArcGIS API 3.0 for Flex and later.
Converting from 2.5 to 3.0 of the ArcGIS API for Flex

The following sections explain the changes you need to make to convert from ArcGIS API 2.5
for Flex to ArcGIS API 3.0 for Flex:
Project property changes

Change the SDK version to at least 4.6.


Change the required Flash player version to 11.1 or later.
Name changes

The following name changes are effective at 3.0:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The webmap package has been renamed portal and includes new classes for connecting to
ArcGIS Online and Portal for ArcGIS.
The Domain class is now an interface and has been renamed IDomain.
The JSON class has been renamed JSONUtil, which is the same naming convention as all the
other classes in the utils package.
The id property in LayerInfo has been renamed layerId.
The attribute , attribute2 , attribute3 , and attributeDelimiter properties
forUniqueValueRenderer that were deprecated at 2.5 have been removed at 3.0;
use field , field2 , field3 , and fieldDelimiter instead.
The attribute property on the ClassBreaksRenderer class has been renamed field .
The href property on the MapImage class has been renamed source .
The arcgisSharingURL property on the WebMapUtil class has been renamed portalURL .
The AttributeInspector form has been sparkified, which includes the following changes:
New AttributeInspectorRenderer in the skins
FieldInspector.renderer is now FieldInspector.editor
FormData is now FormField
New event: FormFieldEvent
The formItemsOrder property on the AttributeInspector class has been
renamed formFieldsOrder .
The fromJSON() and toJSON() methods on FeatureSet take an object instead of a string.
Other changes

The default value for Map.openHandCursorVisible has changed from true to false.
On the GeometryService, the input parameter for the project() method is now
projectParameters instead of geometries. This also allows for specifying datum transformations
(requires ArcGIS 10.1 for Server).
On the Locator, the input parameter for the addressToLocation() method is now
addressToLocationParameters instead of address, outfields. This also adds support for batch
geocoding and searching within an extent (requires ArcGIS 10.1 for Server).
The ClassBreaksRenderer has a new property, isMaxInclusive , that defaults to true to align
with ArcGIS for Server, which is always inclusive. Previously, the behavior was not inclusive. If
you were using ClassBreaksRenderer and taking advantage of the earlier behavior, you now
need to set it to false.
The layerDefinitions property on ArcGISDynamicMapServiceLayer, FindParameters, and
IdentifyParameters can now take LayerDefinition in addition to a string. When using MXML, only
LayerDefinition is allowed. When using ActionScript, both are allowed.
The default value for the UniqueValueRenderer.fieldDelimiter (formerly
UniqueValueRenderer.attributeDelimiter) has changed from "" (empty string) to "," (comma)
and "" is no longer a valid value.
The TextSymbol constructor now takes an alpha value as its fourth parameter. If you were using
the TextSymbol constructor with more than three parameters, you need to adjust accordingly.
The default for the visibleLayers property on ArcGISDynamicMapServiceLayer and
ArcIMSMapServiceLayer changed to null.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Removed properties and methods at 3.0

The units property in Map and Layer has been removed as it is no longer needed; instead, this
information is inferred from the spatial reference.
The visibleLayers property on ArcGISTiledMapServiceLayer has been removed.
The autoMoveToTop property on Graphic has been removed.
The postalTown property on VEAddress has been removed.
The calculationMethod and matchCodes properties on VEGeocodeResult have been removed.
The defaultVisibleLayers() method
on ArcGISDynamicMapServiceLayer andArcIMSMapServiceLayer has been removed.
The convertFromJSON() and convertToJSON() methods on FeatureSet were deprecated at
2.4 and have been removed at 3.0. Use toJSON() and fromJSON() instead.
The zoomToFullExtent() method on NavigationTool was deprecated at 2.3 and has been
removed at 3.0. Use Map.zoomToInitialExtent() instead.
The result event on AttachmentInspector was deprecated at 2.4 and has been removed at 3.0.
Use the event types defined in AttachmentEvent instead.

Migrating from 1.3 to 2.0


In this topic

Requirements

Upgrading your Flex API application code from 1.3 to 2.0

Upgrading your Adobe Flex 3 SDK code to Flex 4 SDK

Version 3.7
This topic contains the following information to successfully migrate from 1.3 to 2.0:

Requirements
Upgrading your Flex API application code from 1.3 to 2.0
Upgrading your Adobe Flex 3 SDK code to Flex 4 SDK

Requirements
The following requirements have changed at 2.0:
Flash Player 10

As part of the move to Flex 4 SDK, Flash Player 10 is now required.


Using Flex 4 SDK instead of Flex 3 SDK

Adobe Flash Builder 4 is very similar to Flex Builder 3, and you should feel right at home from
the beginning.
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

For a basic application, the only migration step is to specify the theme. In Adobe Flash Builder 4,
there is an option for "component set" where you can choose either MX+Spark (the default) or
MX only. To specifically set existing applications to use the "old" Halo theme, add the following
compiler arguments to Project Properties > Flex Compiler:
-theme=${flexlib}/themes/Halo/halo.swc

While it's possible to continue to use Flex Builder 3 if you add Flex 4 SDK support, the
documentation in this Help system assumes you're using Adobe Flash Builder 4 or later.
Similarly, while there are other integrated development environments (IDEs) you can use, the
documentation herein assumes you're using Flash Builder.

Upgrading your Flex API application code from 1.3 to 2.0


The information in this section is to ensure your ArcGIS API for Flex 1.3 code works
withArcGIS API for Flex 2.0 and above. For information on upgrading your code for general
Flex 3 to Flex 4 conversion, see Upgrading your Adobe Flex 3 SDK code to Flex 4 SDKbelow.
Converting from 1.3 to 2.0 of the ArcGIS API for Flex

The following sections explain the changes you need to make to convert from ArcGIS API for
Flex 1.3 to ArcGIS API for Flex 2.0:
Connecting to ArcGIS Server 9.3.x

If you're connecting to an ArcGIS 9.3.x server (as opposed to 10 or later), you might have to
adjust your code as follows, but everything else should work just fine.

For Query and Geoprocessor, add useAMF="false" since AMF is now the default output format,
and older servers do not support AMF.
For ArcGISImageServiceLayer, if you're not already specifying imageFormat, add
imageFormat="png" since "jpgpng" is now the default output format, and older servers do not
support this image format.
Change barriers to pointBarriers.
Change returnBarriers to returnPointBarriers.
Change RouteSolveResult.barriers to RouteSolveResult.pointBarriers

Project property changes

Change the required Flash player version to 10 or higher. Otherwise you might get the following
error: "1046: Type was not found or was not a compile-time constant: Matrix3D."
Change the SDK version to Flex 4. Otherwise you might get the following error: "1046: Type
was not found or was not a compile-time constant: SolidColorStroke."
Package changes

The easiest way to update the import statements in your code to use the new package stcture is to
open your code in Flash Builder 4, set the project to use the Flex 4 SDK and the 2.0 version of
the Flex API, then fix each error as it occurs. One way to do this is to go to the problem line by
double-clicking an error, such as "1046: Type was not found or was not a compile-time constant:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

FeatureSet.", put the cursor at the end of "FeatureSet", and press CTRL-SPACE. Flash Builder
will then add the missing import statement and organize all your import statements as well. The
following is a more extensive list, but again, the easiest way is to take advantage of the IDE and
step through the errors.

The package "controls" has been renamed to components.


The package "symbol" has been renamed to symbols to follow Flex 4 syntax.
The package "toolbars" has been renamed to tools to clarify that it contains tools (or
functionality) rather than visual toolbars.
Supporting classes in the Layers package have moved to a
subpackage:com.esri.ags.layers.supportClasses.
Supporting classes in the Renderers package, that is, ClassBreakInfo and UniqueValueInfo, have
moved to a subpackage:com.esri.ags.renderers.supportClasses.
Supporting classes in the Tasks package have moved to a
subpackage,com.esri.ags.tasks.supportClasses, except for FeatureSet, which is now
incom.esri.ags.FeatureSet.
Supporting classes in the infoClasses and navigationClasses packages have moved to a common
package: com.esri.ags.components.supportClasses.
All events are now in the Events package. This has affected InfoPlacementEvent and
VEGeocodeEvent.
Due to the package changes, you might have to add import statements for certain classes, for
example, the FeatureSet class, which has moved from the com.esri.ags.tasks package to the
com.esri.ags package. You'll get a compile error, for example "1046: Type was not found or was
not a compile-time constant: FeatureSet." One way to fix this is to go to the problem line, put
the cursor at the end of "FeatureSet", and press Ctrl-Space. Flash Builder will then add the
missing one and organize all your import statements.

Name changes

The following name changes are effective at 2.0:

The Draw and Navigation tools have been renamed to DrawTool and NavigationTool,
respectively.
The arealengthsComplete event in GeometryService has been renamed to
areasAndLengthsComplete.
The arealengths property in GeometryServiceEvent has been renamed to
areasAndLengthsComplete.
GPDateUtil has been renamed DateUtil, since dates aren't specific to just the geoprocessor. The
class has moved from com.esri.ags.tasks to com.esri.ags.util for the same reason.
Geoprocessor.outSpatialReference is the new name for the
Geoprocessor.outputSpatialReference property. This makes it consistent with the other "out"
SpatialReference properties.
The getLayerDetails() methods on ArcGISDynamicMapServiceLayer and
ArcGISTiledMapServiceLayer have been renamed to getDetails(). They also have a new
additional method called getAllDetails().
All BufferParameters.UNIT_* constants have been renamed to GeometryService.UNIT_*, since
they've moved to the GeometryService class.
Change BaseTask.sendURLVariable was changed to BaseTask.sendURLVariables (it's now plural).

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Routing now also supports line and polygon barriers. Consequently, the barriers properties on
RouteParameters and RouteSolveResult have been renamed pointBarriers, and the
returnBarriers property on RouteParameters has been renamed returnPointBarriers.

Constructor changes

The following items are effective at 2.0:

Replace the "features" property with "geometries", and make sure you update the value from
an array of features to an array of geometries.
The Extent.contains() method now takes any geometry, combining and expanding the
functionality of the old contains(point) and containsExtent(extent) methods.
The Navigation and Scalebar classes have been "sparkified" to take advantage of new Flex 4
functionality. You can now change the full skin parts instead of just some CSS settings. As part of
this, four classes (NavigationEvent, NavigationMinusButton, NavigationPlusButton, and
NavigationSlider) have been removed and replaced with three skins (NavigationSkin,
NavigationZoomInButtonSkin, and NavigationZoomOutButtonSkin).
Since FeatureLayer now supports selections, there is less reason to perform selections yourself
using the Extent.contains() method.
Inputs for GeometryService are now geometries instead of graphics. See the following code
example:

//1.3:

GeometryServiceEvent now has a generic "results" property instead of arealengths, graphics,


lengths, and relations (depending on the specific method). In the case of a lengths operation,
use Array(event.result) instead of event.lengths as shown in the following code example:

//1.3:

In the response from a buffer operation, the GeometryServiceEvent now returns "result" instead
of "graphics". In the case of a buffer operation, the actual geometries are now returned instead
of an array of graphics as shown in the following code example:

//1.3:

The LayerEvent.TILES_UPDATED constant has been renamed to LayerEvent.UPDATE_END.


There's also a matching LayerEvent.UPDATE_START.
The AREA_LENGTHS_COMPLETE constant in GeometryServiceEvent has been renamed to
AREAS_AND_LENGTHS_COMPLETE.
The GRAPHIC_CLEAR constant has moved from GraphicEvent to GraphicsLayerEvent.

geometryService.project(graphics, new SpatialReference(32618));


//2.0:
geometryService.project([graphic.geometry], new SpatialReference(32618));

Alert.show( "Length of line:" + Number(event.lengths[0]/1000).toFixed(0) + " km." );


// 2.0:
Alert.show( "Length of line:" + Number((event.result as Array)[0] / 1000).toFixed(1) + "
km.");

for each ( var graphic:Graphic in event.graphics )


// 2.0:
for each ( var polygonGeometry:Polygon in event.result)

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The parameterValues property in ExecuteResult has been renamed to "results". It still returns an
array of ParameterValue.
If you're using graphics with PictureMarkerSymbol and listening to events such as a mouse click,
the target is now a custom sprite. In 1.3, the target was a graphic. For more information see
the Adobe help page on event propagation.

Upgrading your Adobe Flex 3 SDK code to Flex 4 SDK


To upgrade your Adobe Flex 3 SDK code to Flex 4 SDK, open your existing application and
make sure the SDK version is set to Flex 4 (in either Flex Builder or Flash Builder). When you
compile it, you might get some errors, or it might just work. Be sure to read the Adobe Flex 4
Features and Migration Guide.
The Adobe Flex Developer Centeris a great place to learn more about Flex in general. The
following links might also be useful in your migration:

Introducing Adobe Flex 4 SDK


What's New in Flash Builder 4 (more than 70 new features)
Moving existing Flex projects from Flex Builder 3 to Flash Builder 4
Differences between Flex 3 and Flex 4

The following sections show the steps to migrate Flex 3 code to Flex 4.
Make it work with Flex 4 SDK

Replace Application.application (as in Application.application.url) with


FlexGlobals.topLevelApplication (and FlexGlobals.topLevelApplication.url).
Switch from Halo (mx) components to Spark components (optional)

Replace mx:Application with s:Application, and set the namespaces as shown in the following
code example:

xmlns:fx="http://ns.adobe.com/mxml/2009"

Put any declarations inside fx:Declarations.


Replace mx:style with fx:style.
Replace mx:ArrayCollection with s:ArrayCollection.
Replace mx:Number with fx:Number.
Consider replacing mx:Text with s:Label.
Default layout is now absolute. To keep it as "vertical", add the following:

Remove any instances of layout="absolute", since it is now the default.

xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"

<s:layout>
<s:VerticalLayout/>
</s:layout>

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Take advantage of new features in Flex 4 SDK (optional)

Read up on Flex 4 and learn more about Spark components, new layouts, skinning, and styling
possibilities.

What was new in ArcGIS API for Flex 2.x


In this topic

ArcGIS API for Flex 2.5

ArcGIS API for Flex 2.4

ArcGIS API for Flex 2.3.1

ArcGIS API for Flex 2.3

ArcGIS API for Flex 2.2

ArcGIS API for Flex 2.1

ArcGIS API for Flex 2.0

Version 3.7
Legacy:

This topic refers to the 2.x versions (2010-2011). For 3.x, see What's New in
ArcGIS API for Flex.
Caution:

If you're upgrading an application from version 1.3 to 2.x, be sure to


readMigrating from 1.3 to 2.0.

ArcGIS API for Flex 2.5


The following functionality, enhancements, changes, and bug fixes are new at version 2.5 which
was released in November 2011:
Enhancements and changes

Editing:

Multipoint editing with Editor component


Snapping to edges (not just nodes)

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Ability to turn on snapping programatically (without the user pressing the Ctrl-key)
Enhancements for editing workflows: Map Service will automatically refresh when a
matching feature layer in selection mode is edited
AttachmentInspector supports tables
Support hosted services on ArcGIS.com
More spark support for Mobile development
New WMTSLayerto support WMTS layers
Improved for ArcGIS.com web maps: popups defined by reference are supported; popups are ignored
when using ignorePopups for tiled and dynamic layers (earlier only feature layers were supported)
Improved KML support
Legend component listens to changes in map layers.
Flare symbol for clusters shows actual symbol of the individual features.
Improved scalebar for Arabic and other right-to-left (RTL) languages
getLegendInfos() now looks for defaultSymbol on UniqueValue and Classbreak renderers
Bug fixes

Version 2.4 PopUp scrollbar bug [see forum post]


Map images in KML layers placed correctly
KML layer groundoverlays always underneath the features
Markers with rotated symbols inside a CompositeSymbol can be selected
ClassBreaks works correct for attributes with nulls and empty strings
Sparkified default InfoSymbol.

ArcGIS API for Flex 2.4


The following functionality, enhancements, changes, and bug fixes are new at version 2.4 which
was released in July 2011:
Functionality

KML Layer gives easy access to data in KML format.


Support for four new locales have been added - Arabic, Brazilian Portuguese, Italian and Russian
- to the existing six locales.
Two mobile samples included in download that shows example of Flex Mobile Projects that can
be deployed on Apple iOS (iPad, iPhone), Google Android and BlackBerry Playbook.
New sample for WMTS.

Enhancements and changes

Better mobile/touch support


Improved support for Adobe Flex 4.5 SDK. Works well when creating Flex Mobile
applications. The mx.swc is no longer required.
Improved pinch: interactive resizing when zooming in or zooming out using two fingers.
Clustering:
Cluster symbols can be modified based on the number of features in the cluster.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Five new properties added to FlareSymbol: backgroundAlphas, backgroundColors,


fractionDigits, sizes and weights.
Five new properties added to SimpleClusterSymbol: alphas, colors, fractionDigits, sizes
and weights.
New property added to WeightedClusterer: center.

WMS:

Supporting WMS Layers in WebMapUtil.


Two new properties added to WMSLayer: maxImageWidth and maxImageHeight.
Four more existing properties of WMSLayer are writable: abstract, initialExtent,
layerInfos and title.
Pan cursor not displayed if the machine doesn't support a cursor.
InfoWindow fires an OPEN event when opened.
Navigation component has been updated to use spark SliderBase instead of mx:Slider as the "slider" skin
part. If you are using a custom navigation skin, it will need to be updated.
The convertToJSON() and convertFromJSON() methods on FeatureSet are being deprecated. Instead use
the new toJSON() and fromJSON() methods.
Bug fixes

Attachment sizes are calculated based on 1,024 bytes in a kilobyte. [NIM070101 AttchmentInspector shows incorrect size of the attachment]
Dates in AttributeInspector can be typed (in addition to using the DatePicker).
Setting dates to null in AttributeInspector works. [NIM070754 - The date field cannot be set to
null after choosing a date from the Date Picker]
Deleting features doesn't send duplicate delete request. [NIM070636 - 2 requests are created
for delete operation in Editor sample]

ArcGIS API for Flex 2.3.1


The following enhancements, changes, and bug fixes are new at version 2.3.1 which was
released in April 2011:
Enhancements and changes

No classes or properties were added in this release.


WebMapUtil does not create layers for map note layers that do not contain features.

Bug fixes

Adding vertices to lines and polygons in projections other than geographic and Web Mercator
works as in 2.2 and earlier. This did not work properly in the 2.3 release.
Snapping works for all projections. In version 2.3, snapping only worked with Web Mercator and
geographic projections.

ArcGIS API for Flex 2.3

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The following functionality, enhancements, changes, and bug fixes are new at version 2.3 which
was released in April 2011:
Functionality

Continuous pan across dateline using the Map.wrapAround180 property.


Snapping while drawing and editing features. Press and hold the Ctrl key to activate snapping.
The snapping distance can be set with the snapDistance property on the DrawTool and EditTool.
The default is 15 pixels.
Support for ArcGIS.com, including configurable pop-up windows .
The Editor.addEnabled property allows you to specify whether or not users can add features
when editing.
The Editor.updateAttributesEnabled property allows you to specify whether or not users can
update attributes when editing.
The Editor.updateGeometryEnabled property allows you to specify whether or not users can
update geometries when editing.
Field-specific ToolTips can be specified in AttributeInspector using
theFieldInspector.toolTip property.
Touch gesture functionality can be turned off using the Map.multiTouchEnabledproperty. If it's
set to false, the pinch-to-zoom and two-finger-tap gestures are disabled.
The Layer.loadFault property lets you know if a layer has tried to load but failed.
The zoomToInitialExtent method and initialExtent property in the Map class allow you to easily
zoom to the initial extent of the map.
The multiTouchEnabled property allows you to turn off multi-touch gestures.
The ignorePopUps property allows you to turn off the import of pop-up windows when creating
a map from an ArcGIS.com web map.
Use the defaultDrawSize property to change the default draw size for rectangles, circles, and
ellipses.
GeometryUtil is a new utility class that allows for more client-side geometry processing.
Fifteen new
classes: FeatureLayerTask, GeometryServiceSingleton, GeometryUtil,InfoComponent, InfoSymbo
lWindow, InfoSymbolWindowSkin, InfoWindowSkin,LabelDataRenderer, PopUpFieldInfoFormat,
PopUpFieldInfo, PopUpInfo,PopUpMediaInfo, PopUpRenderer, PopUpRendererSkin,
and StringUtil.

Enhancements and changes

InfoWindow has been rewritten using Spark and moved from the components package to
the com.esri.ags.components.supportClasses package. It has its own skin, and it's easier to
create your own skins for InfoWindow.
Faster zoom performance when the map contains lots of visible dynamic or graphic layers.
Two more detailed levels for Microsoft Bing Maps with scales of 1:564 and 1:282.
The SpatialReference property on WMSLayer.spatialReference can be set (it's no longer readonly). [Ref: forum post]
Scaling of "extent" graphics. [Ref: forum post]
The Editor remembers the last used geometry tool.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The Editor component supports both polygons and polylines in the same cut operation.
[Ref: forum post]
The zoomToFullExtent method in the NavigationTool class has been deprecated. Use the new
method in the Map class, zoomToInitialExtent, instead.
Use name of layers (if available) in the TemplatePicker.

Bug fixes

The RouteTask checks and handles "null" in compressed geometry.


Annotation layers work with the Legend component. [Ref: forum post]
Better error handling for invalid URLs in the Legend and TemplatePicker components.
Not setting mosaic rules for a .NET ImageServiceLayer highlighted server bug. Workaround is in
place in the 2.3 Flex API.

For a more visual introduction, see the What's New in ArcGIS API for Flex Technical Workshop
video from the 2011 Developer Summit.

ArcGIS API for Flex 2.2


The following functionality, enhancements, changes, and bug fixes are new at version 2.2 which
was released in December 2010:
Functionality

The Legend component allows you to easily create a legend for the layers in the map.
Support for arcgis.com Web Maps: WebMapUtil and WebMapEvent.
Undo/redo support while editing with the Editor component.
The Total query count property is available when using ArcGIS Server 10.0 Service Pack 1.
A version property for ArcGISImageServiceLayer, ArcGISTiledMapServiceLayer,
ArcGISDynamicMapServiceLayer, LayerDetails, and TableDetails.
The useMapTime property adds the option for turning off time awareness of a FeatureLayer,
ArcGISDynamicMapServiceLayer, or ArcGISImageServiceLayer. This is convenient when the map
is time aware, but only certain layers should be time aware.
The minScale and maxScale properties were added to LayerInfo.
The excludeDataAtTrailingThumb and excludeDataAtLeadingThumb properties were added
to TimeSlider.

Enhancements and changes

VETiledLayer uses the latest Bing Maps road style.


More localized strings are available.
The Image format property was added to WMSLayer.
FeatureLayerEvent.features for a selectionClear event contains the unselected features.
[Ref: forum post]

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Bug fixes

Do not reuse the last image when service is turned back on and the sublayers have changed.
[Ref: forum post]
Setting attributes to null when editing are sent to the server. [Ref: forum post]
Zoom to tall extents on tall maps works. [Ref: forum post]
Map and Navigation handle null levels of detail (LOD) better, improving support for toggling
between dynamic and tiled maps. [Ref: forum post]
Time-aware feature layers with both start time and end time fields filter the features correctly
according to the map's timeExtent. [Ref: forum post]
QueryTask.executeRelationshipQuery() returns fields or fieldAliases on the returned
FeatureSets.

ArcGIS API for Flex 2.1


The following functionality and changes are new at version 2.1 which was released in September
2010:
Functionality

New classes:
WMSLayer and WMSLayerInfo support WMS layers. Both classes work with 1.1.0, 1.1.1,
and 1.3.0 WMS servers.
WebMercatorExtent and WebMercatorMapPoint make it easier to specify latlong-based
extents and points for use with Web Mercator maps.
TextField handles long string attribute values in the AttributeInspector component.

New method:
BaseTask.sendURLVariables() supports extending BaseTask.
New properties:
The Method property on BaseTask forces requests to use POST.
Support for drawing circles and ellipses with DrawTool, including two new constants:
DrawTool.CIRCLE and DrawTool.ELLIPSE.
Support for rotating and scaling features, including two new EditTool constants
(EditTool.ROTATE and EditTool.SCALE), six new events for the EditTool (graphicRotate,
graphicRotateStart, graphicRotateStop, graphicScale, graphicScaleStart, and
graphicScaleStop) and their matching EditEvent constants(EditEvent.GRAPHIC_ROTATE,
EditEvent.GRAPHIC_ROTATE_START, EditEvent.GRAPHIC_ROTATE_STOP,
EditEvent.GRAPHIC_SCALE, EditEvent.GRAPHIC_SCALE_START, and
EditEvent.GRAPHIC_SCALE_STOP).
Support for new MapMouseDown event on Map, including a new
constant:MapMouseEvent.MAP_MOUSE_DOWN.
doNotLocateOnRestrictedElements
on ClosestFacilityParameters andServiceAreaParameters.
AttributeInspector.singleToMultilineThreshold.
AttributeInspector.deleteButtonVisible.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

minValue and maxValue on DoubleField handle double precision attribute values in the
AttributeInspector component.
deleteEnabled on AttachmentInspector component and Editor component.
Colors can be specified as VGA color names in addition to hexadecimal formats. The available color
names are Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy, Olive, Purple, Red, Silver, Teal,
White, and Yellow. You can use these VGA color name formats in both style sheet definitions and inline
style declarations. The VGA color names are not case sensitive. In the Flex API, this applies to
SimpleFillSymbol.color, SimpleMarkerSymbol.color, LineSymbol.color, TextSymbol.color,
SimpleClusterSymbol.color, TimeClassBreakInfo.color, and FeatureLayer.selectionColor.
Improved support for touch events to make it easier to use on Android phones and other touch-enabled
devices that support Flash Player 10 or above. The Flex API supports drag to pan, double tap to zoom in,
pinch open to zoom in, pinch close to zoom out, and two-finger tap to zoom out. (The latter three only
work with Flash Player 10.1 or above.)
Changes

Bing requests use Microsoft's new REST API. The postalTown property in the VEAddress class as
well as the calculationMethod and matchCodes properties in the VEGeocodeResult class have all
been deprecated since Microsoft no longer returns them.

ArcGIS API for Flex 2.0


For incremental changes between different 2.0 beta versions, see the detailed beta change log.
Version 2 of the API is based on the Adobe Flex 4 SDK, which requires end users to use Flash
Player 10 or later. See system requirements for more details. The API version 2.0 has been
greatly expanded from version 1.3 with new functionality and components, for example, 101
new classes and 62 new events. Following is a brief summary of new features in version 2.0 of
the ArcGIS API for Flex which was released in June 2010:
Feature Layer

FeatureLayer is a new type of client-side operational layer that can be created and added to a
map. FeatureLayer extends GraphicLayer and works against an individual layer or table in a
MapService or FeatureService.
Feature layers support the following out-of-the-box functionality:

SelectionsSelect features interactively or by attributes. Selections are visualized using the


selection color. You can create a new selection, add to the current selection, or remove from the
current selection using attribute or geometry queries. Interactive selection is done by mapClick
or any of the DrawTool options for creating a geometry to query.
EditingWhen working with an editable layer in a Feature Service, you can add, modify, or
delete features including their related attachments.
DefinitionExpressionLimit features to a subset of the full underlying layer.
QueryInstead of populating a graphics layer with results from a query, you can use a
FeatureLayer.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Query related tablesTake advantage of built-in support for relations between layers and
tables.

For more information, see Feature layers.


Editing using FeatureLayer and ArcGIS Server (requires ArcGIS Server 10.0 and SDE)

At 10.0, a new service, FeatureService, was added to support template-style editing. Several
components have been added to support editing including the Editor component, a configurable
out-of-the-box editing solution.
Additional classes that support editing are as follows:

Attribute Inspector componentSupports editing of attributes of selected features from a


feature layer. Honors domains and subtypes as defined by the service.
EditToolSupports moving graphics and editing vertices.
DrawToolSupports creating new features.
TemplatePicker componentDisplays a gallery of feature templates.
AttachmentInspector componentHelps in uploading and viewing a list of feature attachments.

For more information, see Editing.


Time awareness

Support has been added for time-aware layers and a new TimeSlider component. You can query
or display time-aware layers using a particular slice of time. The TimeSlider provides an easy
way to visualize temporal data. For more information, see Time-aware layers.
Localization

The API has built-in support for six languages: Chinese, English, French, German, Japanese, and
Spanish. For more information, see Localization.
Other updates
Bing Maps

Bing Maps (formerly Microsoft Virtual Earth) authentication uses a "key" property instead of
token, client, and server. There is no longer any need for the Virtual Earth Token page.
The Bing Maps environment property has been removed, since Microsoft no longer supports a
staging environment.

Geometry service

Twelve new operations were added to the GeometryService: Autocomplete, Convex Hull, Cut,
Densify, Difference, Distance, Generalize, Intersect, Offset, Reshape, Trim/Extend, and Union.
The Lengths operation supports units and geodesic distances.
The Areas and Lengths operation supports lengthUnit, areaUnit, and geodesic parameters.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Mapping enhancements

Query enhancements to query for all IDs, which can then be used to include paging in
applications.
Query performance has been improved by adding support for faster JSON and by using AMF
(see the AMF section below).
Support for stand-alone tables.
Ability to expose and query relationships.
The identify and find operations support layer definitions.
A new event, isInScaleRangeChange in the Layer class, is fired when the layer's isInScaleRange
property changes.

AMF

AMF (ActionScript Message Format) has been added in ArcGIS Server 10.0 for faster queries.
AMF is currently supported on FeatureLayer, QueryTask, and Geoprocessor. To connect to a 9.3
server QueryTask or Geoprocessor, you need to set the useAMF property to false.
Geocode updates

Locator supports outSpatialReference when connecting to ArcGIS Server 10.0 and above.
Network Analyst updates

Closest FacilityFunctionality includes the ClosestFacilityTask, a ClosestFacilityEvent,


some input parameters, and the result.
Service AreaFunctionality includes the ServiceAreaTask, a ServiceAreaEvent, someinput
parameters, and the result.
Routing supports attributeParameterValues, polylineBarriers, and polygonBarriers.

Flex 4 and Flash Builder 4 related updates

The API reference is now available in Flash Builder, both as ToolTips and on the ASDoc tab.
The Adobe Flex 4 SDK is required for API development, which means that Adobe Flash Player 10
or above is the required version for browser applications.
TextSymbol uses Flash Player 10 Text Engine, which means that alpha and angle also work for
non-embedded (device) fonts.

Introduction to Flex
Version 3.7
Flex is designed for developers who want to get a working web-based mapping
application up and running very quickly without spending a significant amount of
time developing code. With the ArcGIS API for Flex, users can develop custom

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

applications by integrating ArcGIS Server maps and web services inside Adobe
Flash Builder.
The following topics introduce the basics of Flex to help you begin working with
theArcGIS API for Flex:

Learn about Flex language in Using MXML and ActionScript.

Discover the building blocks of Flex in Flex events and Flex components.

Find useful information on the component life cycle.

MXML and ActionScript in Flex applications


In this topic

Combining MXML and ActionScript

Version 3.7
Flex applications are developed using the MXML and ActionScript languages with the
ActionScript class library, which contains components, manager classes, data service classes,
and classes for all other features.
Learn more about developing with Flex
MXML can be compared to HTML (tags that lay out the page), and ActionScript can be
compared to JavaScript (the coding). In theory, you could write everything as ActionScript code
(add a button here, put the map at the bottom of the page, and so on), but this is neither practical
nor maintainable.
ActionScript 3 syntax is similar to other languages such as C, C#, C++, and Java. ActionScript is
an object-oriented procedural programming language and includes Java object-oriented features,
such as extending classes and implementing interfaces.

Combining MXML and ActionScript


The following are the different ways you can combine MXML and ActionScript:

Use ActionScript in MXML event handlers:


<esri:map load="Alert.show('map is loaded')">

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Use ActionScript <mx:Script> or <mx:initialize> blocks in MXML files:

Include external ActionScript files:

<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function onMapLoad():void
{
Alert.show('Hola Mundo');
}
]]>
</mx:Script>

include "myextracode.as";

Import ActionScript classes.

Note:

Multiple steps take place behind the scenes when Flex compiles your application. The
application is parsed by MXMLC, translated into an ActionScript file, and compiled into a SWF
file.
To better understand how Flex converts MXML tags into code, you can view the interim
ActionScript files. These are deleted unless you specify the "...keep-generated-actionscript"
option when compiling your application.

Flex events
In this topic

Events related to map, layer, and navigation

Events related to tasks

Version 3.7
Flex events are generated when a change, such as user interaction (for example,
click), network traffic (for example, sending and receiving data), or component
modification (for example, resizing), occurs in the application.
An event listener, or handler, allows you to detect when these events occur and
tell the Flex application how to respond.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Event listeners can be added easily with ActionScript:


myMap.addEventListener(MouseEvent.CLICK, onClickFunction);

or MXML:
<esri:Map id="myMap" click="onClickFunction(event)">

The ArcGIS API for Flex adds specific events for map, navigation, and tasks,
which are located in the com.esri.ags.events package.

Events related to map, layer, and navigation


The following table lists the 15 events related to map, layer, and navigation:
Event

Description
Represents event objects specific to FeatureLayer attachment operations. [New in
AttachmentEvent
version 2.0]
DrawEvent
Represents event objects specific to DrawTool.
EditEvent
Represents event objects specific to EditTool. [New in version 2.0]
ExtentEvent
Represents event objects specific to map extent changes.
FeatureLayerEvent Represents event objects specific to FeatureLayer. [New in version 2.0]
FlareEvent
Represents event objects specific to the Flare symbol.
FlareMouseEvent Represents event objects specific to the Flare symbol.
GraphicEvent
Represents event objects specific to graphics.
GraphicsLayerEvent Represents event objects specific to GraphicsLayer. [New in version 2.0]
LayerEvent
Represents event objects specific to a layer.
MapEvent
Represents event objects specific to the map.
MapImageEvent
Represents event objects specific to ArcGISDynamicMapServiceLayer.
MapMouseEvent
Represents event objects specific to map mouse events. [New in version 1.1]
NavigationEvent
Represents event objects specific to the navigation component.
PanEvent
Represents event objects specific to panning the map.
TimeExtentEvent Represents event objects specific to time extent changes. [New in version 2.0]
ZoomEvent
Represents event objects specific to the zooming (changing scale) of the map.

Events related to tasks


The following table lists the ten events related to tasks:
Event
AttributeInspectorEvent
ClosestFacilityEvent

Description
Represents event objects specific to the AttributeInspector. [New in version
3.0]
Represents event objects specific to ClosestFacilityTask. [New in version

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

2.0]
Represents event objects specific to DetailsTask. [New in version 2.0]
Represents event objects specific to FindTask.
Represents event objects specific to FindTask. [New in version 3.0]
Represents event objects that are specific to GenerateRendererTask. [New
GenerateRendererEvent
in version 3.0]
GeometryServiceEvent
Event dispatched when an AttributeInspectorFormField is updated.
GeoprocessorEvent
Represents event objects specific to Geoprocessor task.
IdentifyEvent
Represents event objects specific to IdentifyTask.
Represents event objects that are specific to IdentityManager. [New in
IdentityManagerEvent
version 3.0]
Represents event objects that are specific to ImageServiceIdentifyTask.
ImageServiceIdentifyEvent
[New in version 3.0]
Bubbling event dispatched usually from an info container's content to
InfoPlacementEvent
reposition the container around its anchor location based on the value of the
event infoPlacement property. [New in version 3.0]
Represents event objects that are specific to JSONTask. [New in version
JSONEvent
3.0]
LocatorEvent
Represents event objects specific to Locator tasks.
PortalEvent
Represents event objects that are specific to the portal. [New in version 3.0]
QueryEvent
Represents event objects specific to QueryTask.
RouteEvent
Represents event objects specific to RouteTask. [New in version 1.2]
ServiceAreaEvent
Represents event objects specific to ServiceAreaTask. [New in version 2.0]
Represents event objects that are specific to TemplatePicker. [New in
TemplatePickerEvent
version 3.0]
Represents event objects that are specific to WebMapUtil. [New in version
WebMapEvent
3.0]
For more information about handling events in your Flex applications, see the Flex 3 Getting
Started Guide Wiki article Handling Events.
DetailsEvent
FindEvent
FormFieldEvent

Flex components
In this topic

Components

Containers

Version 3.7
The ArcGIS API for Flex provides built-in MXML visual components and containers.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Components
Components, sometimes referred to as controls, are interface widgets that can be added to your
application. Apache Flex components include Button, Label, Form, and TextInput. ArcGIS API
for Flex components include ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer,
and ArcIMSMapServiceLayer.
Tip:

MXML is typically used for layout purposes; however, you can also use ActionScript 3.0 to create and
modify components. To see Flex components in action, check out the Tour de Flex application.

Containers
Containers are layout tools that position the interface widgets or data in the application. Some
example Apache Flex containers are Application, HGroup, VGroup, and BorderContainer;
the ArcGIS API for Flex container is Map.
Containers provide a hierarchical structure that allows you to control the layout characteristics of
child components. Components defined within a container are called children. At the root of any
Flex application is a single container: the Application container.

Component life cycle


In this topic

Instantiation life cycle

More information

Version 3.7
Flex is an event-driven programming model. All Flex components undergo the same
instantiation life cycle during which Flex automatically calls component methods, dispatches
events, and makes the component visible.
Knowing the details of this life cycle will help you understand the sequence of events, which
allows you to listen and wait for the proper events.

Instantiation life cycle


The following diagram shows the instantiation life cycle for both Flex and ArcGIS API for Flex.
The various stages are described below.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Note:

After all components are created and drawn, the Application object dispatches an
applicationComplete event. This is the last event dispatched during application startup.

preinitializeAn event dispatched before initialization takes place. When Flex dispatches the
preinitialize event, the children of a component, including internal children, have not yet been
created. It is only useful in rare situations when you must set properties on a parent before the
children are created.
childAddDispatched on the parent container after all children have been initialized but before
the component has been sized and processed for layout.
initializeAn event dispatched to alert initialization. At this time, all the component's children
have been initialized, but the component has not been fully processed or sized for layout.
creationCompleteSignals that the object is complete. This is called after Flex sets the visible
property to true. The component has been sized and processed for layout and all properties are
set. This event is dispatched only once.
updateCompleteFlex dispatches additional updateComplete events whenever the position,
size, or other visual characteristic of the component changes and the component has been
updated for display.
loadSpecific to the ArcGIS API for Flex. This applies to Map and Layer and, consequently,
GraphicsLayer, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer,
ArcGISImageServiceLayer, and ArcIMSMapServiceLayer events. It is dispatched after its
properties are set up but before the map is downloaded and displayed.

Tip:

When working with maps and layers, use the load event in the ArcGIS API for Flexinstead of the
generic creationComplete event. This will ensure that map properties, such as extent and
spatialReference, are available.

More information
For further information about the Flex life cycle, see the following:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Detailed description of the component instantiation life cycle


About startup order
Sample event flow for an MXML application

Mobile applications with Flex


Version 3.7
Creating mobile applications for iOS and Android is easy with Adobe Flash
Builder 4.5.1 or later. Esri has supported Flex mobile applications since the
release of the 2.4 ArcGIS API for Flex. Use version 3.0 or later of the ArcGIS API
for Flex for best experience (which requires Flex SDK version 4.6.0 or later). For
more information about delivering native experiences on mobile devices using
Flex, see the Adobe Mobile FAQ.
The API samples includes multiple Flex mobile samples. Below are the steps to get one of those
samples running. You can access the samples from GitHub.
1. Open Adobe Flash Builder, choose File > Import Flash Builder Project.
2. Select Project folder > Browse and navigate to the downloaded project folder.
3. Add the API Library to the project through Project > Properties > Flex Build Path >Library Path > Add
SWC and locate the agslib-3.x-201x-xx-xx.swc library file.
4. Add the following libraries to the build library
path: ${PROJECT_FRAMEWORKS}/libs/mx/mx.swc and ${PROJECT_FRAMEWORKS}/libs/sparkskins.sw
c.
5. Run the application using a simulator or on a physical device. Using the Run Configurations (Run > Run
Configuration) you can add a Mobile application and define the Launch Method as appropriate.
Caution:

There is a known-limit when working with pop-up windows in mobile applications created with
version 3.1. If doing so, please note that you will need to either: Add
both mx.swc and sparkskins.swc to your project, or update PopUpRendererSkin and remove
references to the RelationshipInspector .
Caution:

If working with version 3.4 or above, you will come across errors unless you implement one of
the following two options:
1. Add both the following libraries to the build library
path: ${PROJECT_FRAMEWORKS}/libs/mx/mx.swc and ${PROJECT_FRAMEWORKS}/libs/sparkskins.sw
c

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

2. Or, if you do not wish to go with the first option, you will need to a modify
the AttributeInspectorSkin so that it no longer references CalendarField and the MemoField .
Please see the snippet below demonstrating this.
AttributeInspectorSkin using a TextField instead of CalendarField and MemoField.
<fx:Component id="dateField">
<!--<fieldClasses:CalendarField dateFormat="shortDate" useUTC="false"/>-->
<fieldClasses:TextField minWidth="200"/>
</fx:Component>
<fx:Component id="memoField">
<!--<fieldClasses:MemoField minWidth="200"/>-->
<fieldClasses:TextField minWidth="200"/>
</fx:Component>

After modifying this skin, you will also need to override two styles in defaults.css . This file
must be in the root of the src folder.
Modified defaults.css file that references the customized AttributeInspectorSkin.
@namespace esri "http://www.esri.com/2008/ags";
esri|AttributeInspector, esri|RelationshipInspector #attributeInspector
{
skinClass: ClassReference("skins.AttributeInspectorSkin");
}

API Diagram
Version 3.7
The following diagram shows the logical grouping of all the classes and
packages in the ArcGIS API for Flex. You can also download a PDF version.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Localization
In this topic

Support for different locales

Version 3.7

Support for different locales


The ArcGIS API for Flex has built-in support for the 23 languages listed below. Localization
support was added for six languages in version 2.0, four more languages in version 2.4, six
languages in version 3.0, an additional six in 3.2, and Finnish added at 3.5. To use one of them,
compile your Flex application with the appropriate locale.

Arabic (ar)Added in version 2.4


Brazilian Portuguese (pt_BR)Added in version 2.4
Danish (da_DK)Added in version 3.2
Chinese (zh_CN)
Dutch (nl_NL)Added in version 3.0
English (en_US)
Estonian (et_EE)Added in version 3.2
Finnish (fi_FI)Added in version 3.5
French (fr_FR)
German (de_DE)
Hebrew (he_IL)Added in version 3.2
Italian (it_IT)Added in version 2.4
Japanese (ja_JP)
Korean (ko_KR)Added in version 3.0
Latvian (lv_LV)Added in version 3.2
Lithuanian (lt_LT)Added in version 3.2
Norwegian (nb_NO)Added in version 3.0
Portuguese (pt_PT)Added in version 3.2
Polish (pl_PL)Added in version 3.0
Romanian (ro_RO)Added in version 3.0
Russian (ru_RU)Added in version 2.4
Spanish (es_ES)
Swedish (sv_SE)Added in version 3.0

Compile with the specific locale

To compile with the specific locale or locales, take the following steps in Flash Builder:
1. Go to Project > Properties > Flex Compiler.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


2. Set the Additional compiler arguments to your language, for example, es_ES for Spanish. In Flash
Builder, compile with the specific locale(s): -locale=es_ES .
3. To compile in multiple languages, list them comma-separated: -locale=en_US,fr_FR
Locales not supported by Adobe or Apache Flex SDKs
Note:

Adobe 4.6.0 supports 16 locales out of the box (see your Flash Builder install, for
example, C:\Program Files (x86)\Adobe\Adobe Flash Builder
4.6\sdks\4.6.0\frameworks\locale ), while Apache Flex 4.10.0 supports 23 different locales.
This still leaves seven locales supported by Esri that are not supported by the underlying Flex
SDKs. If you you want to add support for a locale not supported by your SDK, please follow the
steps below.
Create the supporting Adobe or Apache Flex SDK files
1. Go to the command prompt on Windows > Start Menu > Run > then type cmd .
2. Type the path to your Flash Builder SDK directory, (for example, cd "C:\Program Files
(x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\bin" ) and press Return.
3. Type copylocale en_us ar . This will create an ar folder with a supporting frameworks file
(most likely in C:\Program Files (x86)\Adobe\Adobe Flash Builder
4.6\sdks\4.6.0\frameworks\locale ).
Tip:

If the above step doesnt create a folder, you can run the above command with admin
privileges.
4. In Flash Builder, right-click Project > Properties and set Additional Compiler arguments to locale=ar,en_US .
Translate the supporting Adobe SDK files (optional)
Depending on which Flex components you're using, you can translate all or some of those in the
supporting Adobe SDK files. This step is optional.
Additional languages

For languages other than those listed above, translate the English resource file, i.e.
ESRIMessages.properties, to the desired language. Then compile your Flex application with the
appropriate locale as described in the following steps:
1.
2.
3.
4.

Copy the resource file into your Flash Builder project.


Translate the strings in the resource file.
Go to Project > Flex Compiler.
Set the Additional compiler arguments : -locale=et_EE -source-path=locale/{locale}

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Note:

The ESRIMessages.properties file is located in the /locale/en_US directory that is part of the
API download.

Coordinate system IDs


Version 3.7
The positions of objects on the earth's spherical surface
are measured in degrees of latitude and longitude, also
known as geographic coordinates. Latitude and longitude
are not uniform units of measure; only along the equator
does the distance represented by one degree of
longitude approximate the same distance of latitude.
To overcome measurement discrepancies, data is often
transformed from the three-dimensional geographic
coordinate system to a two-dimensional planar surface in
a projected coordinate system.
Each coordinate system is defined by both a well-known
ID (WKID) or a definition string (well-known text [WKT]).
The ArcGIS API for Flex supports WKID and, if using
ArcGIS Server 10.0 or higher, WKT. For a complete list

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

of supported IDs and their corresponding definition


strings, see the following:

Geographic coordinate systems

Projected coordinate systems

Vertical coordinate systems

FAQs
QueryTask or FeatureLayer only returns 500 or 1,000
features
By default, the server is limiting each service to returning
1,000 features at ArcGIS Server version 10.0 or later and
500 features at version 9.3. You can modify this on your
ArcGIS Server.
For more information on how to do this, please see
the setting map service propertieshelp topic.
ArcGISDynamicMapServiceLayer displays in wrong
location if map is wider than 2048 pixels
By default, the server does not allow dynamic maps
larger than 2048x2048 pixels. However, this is
configurable on your ArcGIS Server. You can set
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

the maxImageWidth and maxImageHeight properties of the


service when you publish it. Please reference the ArcGIS
Help regarding this here.
Proxy page isn't working in Firefox in specific
circumstances
Adobe Flash Player in Firefox does not send the HTTP
referrer along with requests that are sent with GET.
However, when using POST, the HTTP referrer is sent
and everything works fine.
To get around this, Force the request to be sent using
POST. This is automatically done when the request size
is 2,000 characters or more, as well as when a token is
specified. In version 2.1 of the API, there is a new
property called method that you can use to force the
POST. In version 2.0, you can specify a token (even if
you don't need one), for example token=hack .
How do I upload large attachments?
For ArcGIS Server version 10.1:

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

There is an Uploads capability on the geoprocessing


service property page. Default maximum size is 2 GB.
This can be modified to upload larger files. More
information regarding this can be found
at Geoprocessing service settings: Advanced properties.
For ArcGIS Server version 10.0:
1. .NETThe max allowed upload size is the smallest value defined by the following:

<MaxUploadSize>20480</MaxUploadSize> as defined in the rest.config file. or

ASP .NET Max Request length as defined in web.config. See KB article 35971 for more
info.

JavaThe default max allowed upload size is 20 MB. This can be modified by setting
the config.max-upload-size property in rest-config.properties.

I cannot load data from my server


1. Make sure that REST is set up and your Service Directory is available. If you're on the server
machine, you should be able to go to it using Start > All Programs > ArcGIS Server for the
Microsoft .NET Platform > ArcGIS Services Directory. The exact URL will vary based on
platform and whether you have customized it. By default, the URL on the .NET platform will be
similar to http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/ , and for the Java
platform, the default will be similar to http://myjavaserver:8399/arcgis/rest/services/ .

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

2. Make sure that the REST endpoint for the service is available. For
example, http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI
_Census_USA/MapServer .

3. If your SWF is not on the same web server as your map service(s), ensure you have
acrossdomain.xml file.
4. Look at the HTTP request and response, for example, using the HttpFox (a Firefox add-on),
Fiddler, Charles and so on, to see if any of them are failing.
5. For additional information, read the Deploying your application and Using
crossdomain.xml topics, as well as the next problem in this FAQ.

An external data source is not accessible outside your


application's domain (crossdomain.xml)
To access data from a remote server (a different server
from the one where your Flex application is hosted), the
remote server needs to have a crossdomain.xml file in
the root directory. For sandbox security reasons, the web
browser is not allowed to access data that resides
outside the exact domain where the SWF file originated.
However, Adobe Flash Player can load data across
domains if permission is granted from the server. This is
accomplished by having a small crossdomain.xml file on
the remote server that permits Flash to connect to

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

services on that server. For additional information,


read Using cross-domain policy files. In the Adobe Flex 3
Help, see theAdobe TechNote External data not
accessible outside a Macromedia Flash movie's domain,
or view a sample cross-domain file.
Adobe Flash Builder reports the following problem: Could
not resolve <esri:...> to a component implementation
Adobe Flash Builder cannot find the .swc file, i.e.
where esri:... is defined. Try one of the following
solutions:
1. Put the .swc file in the libs folder of your Flash Builder project.
2. Specify the library path in Flash Builder. To do this, follow these steps:
1. Right-click the project
2. Choose Properties
3. Chose Flex Build Path on the left-hand side
4. Click the Library Path tab
5. Add a specific SWC using the Add SWC Folder button to add all the SWC files in a specific
folder

How do I create a legend for a map service?


Use the Legend componentintroduced in version 2.2.
Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

The tile layer does not show on top of the dynamic layer
Currently, tiled layers display only when the scale is
exactly the same as one of the supported scale levels. If
you start your map with a dynamic layer, all scale levels
will be supported. To lock in the scale levels of a tiled
map, add the tiled layer as the basemap (first layer).
Then, on creation, reorder the layers so the dynamic
layer is on the bottom.
Why is my mobile application throwing errors when
working with pop-up windows?
There is a known-limit when working with pop-up
windows in mobile applications created with version 3.1.
If doing so, please note that you will need to either:
1. Add both mx.swc and sparkskins.swc to your project, or
2. Update PopUpRendererSkin and remove references to the RelationshipInspector component.

Beginning with version 3.4, I receive an error "Class


mx.controls.::DataField could not be found" when
running my mobile application. How do I get around this
error?

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Implement one of the following two options:


1. Add both the following libraries to the build library
path: ${PROJECT_FRAMEWORKS}/libs/mx/mx.swc and ${PROJECT_FRAMEWORKS}/libs/sparkskins.sw
c

2. Or, if you do not wish to go with the first option, you will need to a modify
the AttributeInspectorSkin so that it no longer references CalendarField and the MemoField .
Please see the snippet below demonstrating this.

AttributeInspectorSkin using a TextField instead of CalendarField and MemoField.


<fx:Component id="dateField">
<!--<fieldClasses:CalendarField dateFormat="shortDate" useUTC="false"/>-->
<fieldClasses:TextField minWidth="200"/>
</fx:Component>
<fx:Component id="memoField">
<!--<fieldClasses:MemoField minWidth="200"/>-->
<fieldClasses:TextField minWidth="200"/>
</fx:Component>

In addition to the above modification, you will need to


override two styles in defaults.css . This file must be in
the root of the src folder.
Modified defaults.css file that references the customized AttributeInspectorSkin.
@namespace esri "http://www.esri.com/2008/ags";
esri|AttributeInspector, esri|RelationshipInspector #attributeInspector
{
skinClass: ClassReference("skins.AttributeInspectorSkin");
}

Why are some images omitted from the export build of


Flex API application?

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Flash Builder does not export out embedded images


while performing an export build . In turn, if you try to
reference this image by a URL, it will not work. You will
need to make a copy of the image and use that image or
manually copy the image in the export build.
How can I tell what version of the ArcGIS API for Flex
was used when working in a web application?
Right-click on the map within the web application.
Click About ArcGIS API for Flex in the context menu to
find out the API version. This will provide additional
information with version information regarding the
ArcGIS API for Flex.
How do I verify the integrity of the downloaded ArcGIS
API for Flex library (.swc) file?
Every release of the ArcGIS API for Flex library has an
MD5 checksum associated with it (see table below).
After downloading and uncompressing the ZIP file, you
should calculate the checksum for the SWC file and
make sure it matches with the checksum in the table
below.

Copyright 2016 Esri. All rights reserved.

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

You can use the checksum task of Apache ANT to


generate an MD5 checksum of your downloaded file. On
Mac OS X, bring up the Terminal and type agslib-3.72014-11-06.swc .
Version

Filename

3.7
agslib-3.7(November
66c42fc1d9cc8789c8d653493bd2d9d4
2014-11-06.swc
6, 2014)
3.6
agslib-3.6(December
cdd403bdd2f844c7684350ceb5c1b526
2013-12-13.swc
13, 2013)
3.5
agslib-3.5(September
9bb53a1fce1db593881ff37c3cfae4ee
2013-09-19.swc
19, 2013)
3.4 (June agslib-3.4e502584786dea28bc9031f33521652a7
30, 2013) 2013-06-30.swc
3.3 (April agslib-3.3a651a645085c33e5eb2e20a2cd447bf8
24, 2013) 2013-04-24.swc
3.2 (March agslib-3.2e09821452f0d7998b43983f99dc2a3ed
19, 2013) 2013-03-19.swc
3.1
agslib-3.1(December
968ba76f097a996898df622fc2934a30
2012-12-12.swc
12, 2012)
3.0 (June agslib-3.0003fd279517b0265aadcee5d4ce07d54
6, 2012) 2012-06-06.swc
2.5
agslib-2.5(November
0bc96c72ae7498c6eeaeaf897587392e
2011-11-30.swc
30, 2011)
2.4 (July agslib-2.446bf6a33c58a4db6921623a549a3ee1c
25, 2011) 2011-07-25.swc
2.3.1
agslib-2.3.1(April 26,
3f3230ff42adf47a1286a3e0b536f5b7
2011-04-26.swc
2011)
2.3 (April agslib-2.3498935f8f7ecbc6e2e68498225b9f0a7
14, 2011) 2011-04-14.swc
2.2
agslib-2.2(December
09866c1fef26605ab7febddce3065134
2010-12-08.swc
8, 2010)
2.1
agslib-2.137164e154e8338ac7e39f5f2e9a3afe0
Copyright 2016 Esri. All rights reserved.

MD5 checksum

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm


Version

Filename

(September 2010-09-17.swc
17, 2010)
2.0 (June agslib-2.0499450929f89e737c1895a3728cbefee
25, 2010) 2010-06-25.swc
2.0 Beta
agslibUpdate 3
2.0betaUpdate3- e8395dce1d8dacc45f86dafaf2176b96
(May 18,
2010-05-18.swc
2010)
2.0 Beta
agslibUpdate 2
2.0betaUpdate2- a61547db7422754bad59aac24887d73c
(April 7,
2010-04-07.swc
2010)
2.0 Beta
agslibUpdate 1
2.0betaUpdate1- e7fb73d79208ba97a6972f41d03d2036
(February
2010-02-26.swc
26, 2010)
2.0 Beta
agslib-2.0beta(February
d95481a7f419bc573dd05fa174d4643d
2010-02-02.swc
2, 2010)
1.3
agslib-1.3(October
c294d5a1376c12a543c0c18a4fa69d7d
2009-10-31.swc
31, 2009)
1.2 (May agslib-1.21ef1e47f6767d85b3393fff4ffa6e2cd
15, 2009) 2009-05-15.swc
1.1
agslib-1.1(January
be3f53519b6943a76967a6f67c2d0f1b
2009-01-21.swc
21, 2009)
1.0
agslib-1.0(October
02c1769a61236a5d18be8fded9ad0342
2008-10-22.swc
22, 2008)

Getting help
In this topic

ArcGIS API for Flex

ArcGIS Server

Flex

Copyright 2016 Esri. All rights reserved.

MD5 checksum

Copied from: https://developers.arcgis.com/flex/guide/coordinate-system-ids.htm

Version 3.7
ArcGIS API for Flex
If you have questions about the ArcGIS API for Flex, visit the user-to-user discussionforum or
check out these additional Esri resources. The forum brings together ArcGIS API for Flex users
for collaborative online discussions and code sharing.

ArcGIS Server
For information on ArcGIS Server, visit the ArcGIS Resource Center. If you already own
ArcGIS Server, many support resources are available to help you get started and meet your
application needs.

Flex
To learn more about Apache Flex (formerly Adobe Flex), explore the following links:

What is Flex?
Apache Flex
Adobe Tour de Flex (web version)
Flex Developer Center

Copyright 2016 Esri. All rights reserved.

You might also like