This page describes an older version, please see latest API at http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html.
Packagecom.esri.ags.layers
Classpublic class ArcGISDynamicMapServiceLayer
InheritanceArcGISDynamicMapServiceLayer Inheritance DynamicMapServiceLayer Inheritance Layer Inheritance mx.core.UIComponent
Implements ILegendSupport

Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above). A dynamic map service generates images on the fly.

Note that ArcGISDynamicMapServiceLayer, like all layers, extend UIComponent and thus include basic mouse events, for example: click, mouseOut, mouseOver, and mouseDown, as well as other events like show and hide, and general properties, such as alpha and visible.

MXML usage of ArcGISDynamicMapServiceLayer:
 <esri:Map>
     <esri:ArcGISDynamicMapServiceLayer
         url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer"/>
 </esri:Map>
MXML to set specific visible layers:
 <esri:Map>
     <esri:ArcGISDynamicMapServiceLayer id="dynamicCensusBlockPoints"
         url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer">
         <esri:visibleLayers>
             <s:ArrayCollection>
                 <fx:Number>0</fx:Number> <!-- Only show this specific layer -->
             </s:ArrayCollection>
         </esri:visibleLayers>
     </esri:ArcGISDynamicMapServiceLayer>
 </esri:Map>

See also

com.esri.ags.events.LayerEvent
com.esri.ags.events.MapImageEvent
Live sample - Dynamic Map
Live sample - Dynamic Map Layers on/off


Public Properties
 PropertyDefined By
  capabilities : Array
[read-only] Capabilities of the map service, possible array values are Map, Query, and Data.
ArcGISDynamicMapServiceLayer
  copyright : String
[read-only] Map copyright as defined by the map service.
ArcGISDynamicMapServiceLayer
  description : String
[read-only] Map description as defined by the map service.
ArcGISDynamicMapServiceLayer
  disableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
ArcGISDynamicMapServiceLayer
  dpi : Number
The output dpi of the dynamic map service layer.
ArcGISDynamicMapServiceLayer
  fullExtent : Extent
[read-only] Full extent as defined by the map service.
ArcGISDynamicMapServiceLayer
  imageFormat : String
The output image type.
ArcGISDynamicMapServiceLayer
  imageTransparency : Boolean
Whether or not the background of dynamic image is transparent.
ArcGISDynamicMapServiceLayer
  initialExtent : Extent
[override] [read-only] Initial extent as defined by the map service.
ArcGISDynamicMapServiceLayer
 InheritedisInScaleRange : Boolean
[read-only] Returns true if the current scale of the map is between the maximum and minimum scale of the layer [added in version 1.3].
Layer
  layerDefinitions : Array
Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image.
ArcGISDynamicMapServiceLayer
  layerInfos : Array
[read-only] The available layers in the map service and their default visibility.
ArcGISDynamicMapServiceLayer
  layerInfoWindowRenderers : Array
Array of LayerInfoWindowRenderers that allow you to define infoWindowRenderers for specific layers [added in version 2.3].
ArcGISDynamicMapServiceLayer
  layerTimeOptions : Array
Array of LayerTimeOptions that allow you to override how a layer is exported in reference to the map's timeExtent [added in version 2.0].
ArcGISDynamicMapServiceLayer
 Inheritedloaded : Boolean
[read-only] When the layer is loaded, the value becomes "true" and layer properties can be accessed.
Layer
 InheritedloadFault : Fault
[read-only] A reference to the fault that is dispatched when the layer throws a loadError event.
Layer
 Inheritedmap : Map
[read-only] A reference to the Map this layer is in.
Layer
 InheritedmaxScale : Number
The maximum scale of the layer [added in version 1.3].
Layer
 InheritedminScale : Number
The minimum scale of the layer [added in version 1.3].
Layer
  proxyURL : String
The URL to proxy the request through.
ArcGISDynamicMapServiceLayer
  requestTimeout : int
The request timeout in seconds.
ArcGISDynamicMapServiceLayer
  serviceDescription : String
[read-only] Map service description as defined by the map service.
ArcGISDynamicMapServiceLayer
  spatialReference : SpatialReference
[override] [read-only] The spatial reference of the map service.
ArcGISDynamicMapServiceLayer
  tableInfos : Array
[read-only] The stand-alone tables in the map service [added in version 2.0].
ArcGISDynamicMapServiceLayer
  timeInfo : TimeInfo
[read-only] Only the TimeInfo's timeExtent and timeReference properties may be available [added in version 2.0].
ArcGISDynamicMapServiceLayer
  timeOffset : Number
The time offset for the layer [added in version 2.0].
ArcGISDynamicMapServiceLayer
  timeOffsetUnits : String
The units of the timeOffset [added in version 2.0].
ArcGISDynamicMapServiceLayer
  token : String
Token for accessing a secure dynamic ArcGIS service.
ArcGISDynamicMapServiceLayer
  units : String
[override] [read-only] The units of the layer.
ArcGISDynamicMapServiceLayer
  url : String
URL endpoint of a service.
ArcGISDynamicMapServiceLayer
  useMapTime : Boolean
If true and the map service is time aware, a new map image will be requested whenever the map's timeExtent changes.
ArcGISDynamicMapServiceLayer
  version : Number
[read-only] The version of ArcGIS Server where the map service is published to, for example, 9.3, 9.31, 10, 10.01 or 10.1.
ArcGISDynamicMapServiceLayer
  visibleLayers : ArrayCollection
Sets the visible layers of the exported map.
ArcGISDynamicMapServiceLayer
Public Methods
 MethodDefined By
  
ArcGISDynamicMapServiceLayer(url:String = null, proxyURL:String = null, token:String = null)
Creates a new ArcGISDynamicMapServiceLayer object.
ArcGISDynamicMapServiceLayer
  
Clears the visible layers as defined in visibleLayers and resets to the default layers of the map service.
ArcGISDynamicMapServiceLayer
  
exportMapImage(imageParameters:ImageParameters = null, responder:IResponder = null):AsyncToken
Exports a map using values from the layer as defaults.
ArcGISDynamicMapServiceLayer
  
getAllDetails(responder:IResponder = null):AsyncToken
Gets the detailed information for all the ArcGIS layers and tables in the service.
ArcGISDynamicMapServiceLayer
  
getDetails(layerOrTableId:Number, responder:IResponder = null):AsyncToken
Gets the detailed information for an ArcGIS layer or table.
ArcGISDynamicMapServiceLayer
  
getLegendInfos(responder:IResponder = null):AsyncToken
Gets legend infos.
ArcGISDynamicMapServiceLayer
 Inherited
refresh():void
Causes the layer to redraw or reload its content.
Layer
Protected Methods
 MethodDefined By
 Inherited
Adds listeners for ExtentEvent.EXTENT_CHANGE, ZoomEvent.ZOOM_START, ZoomEvent.ZOOM_UPDATE and ZoomEvent.ZOOM_END.
Layer
 Inherited
When an EXTENT_CHANGE event occurs, this calls invalidateLayer();
Layer
 Inherited
hideHandler(event:FlexEvent):void
When the layer is hidden (visible is set to false), this calls removeMapListeners().
Layer
 Inherited
Subclasses should call this whenever they would like to have updateLayer() called on them.
Layer
 Inherited
loadMapImage(loader:Loader):void
Subclasses must override this method.
DynamicMapServiceLayer
 Inherited
Removes all the layers children.
Layer
 Inherited
Removes the four event listeners added by addMapListeners();
Layer
 Inherited
setLoaded(value:Boolean):void
Subclasses must call this when they've loaded all their properties and are ready to load their content.
Layer
 Inherited
showHandler(event:FlexEvent):void
When the layer is shown (visible is set to true), this calls addMapListeners() and invalidateLayer().
Layer
 Inherited
toScreenX(mapX:Number):Number
Converts the x-coordinate of map point to a screen point.
Layer
 Inherited
toScreenY(mapY:Number):Number
Converts the y-coordinate of map point to a screen point.
Layer
 Inherited
Subclasses must override this method.
Layer
 Inherited
Finishes the zoom animation.
Layer
 Inherited
Prepares the zoom animation by taking a bitmap of the layer.
Layer
 Inherited
Redraws the bitmap of the layer.
Layer
Events
 Event Summary Defined By
  Dispatched when getAllDetails, getDetails or exportMapImage operations fails.ArcGISDynamicMapServiceLayer
  Dispatched when an getAllDetails operation successfully completes.ArcGISDynamicMapServiceLayer
  Dispatched when an getDetails operation successfully completes.ArcGISDynamicMapServiceLayer
 InheritedFires if the value of isInScaleRange changes.Layer
 InheritedFires after layer properties for the layer are successfully populated.Layer
 InheritedFires if the layer is unable to load.Layer
  Dispatched when an exportMapImage operation successfully completes.ArcGISDynamicMapServiceLayer
 InheritedFires when the layer has finished updating its content.Layer
 InheritedFires when the layer begins to update its content.Layer
Property Detail
capabilitiesproperty
capabilities:Array  [read-only]

Capabilities of the map service, possible array values are Map, Query, and Data.

This property can be used as the source for data binding.


Implementation
    public function get capabilities():Array
copyrightproperty 
copyright:String  [read-only]

Map copyright as defined by the map service.

This property can be used as the source for data binding.


Implementation
    public function get copyright():String
descriptionproperty 
description:String  [read-only]

Map description as defined by the map service.

This property can be used as the source for data binding.


Implementation
    public function get description():String
disableClientCachingproperty 
disableClientCaching:Boolean

If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get disableClientCaching():Boolean
    public function set disableClientCaching(value:Boolean):void
dpiproperty 
dpi:Number

The output dpi of the dynamic map service layer.

The default value is 96.

This property can be used as the source for data binding.


Implementation
    public function get dpi():Number
    public function set dpi(value:Number):void
fullExtentproperty 
fullExtent:Extent  [read-only]

Full extent as defined by the map service.

This property can be used as the source for data binding.


Implementation
    public function get fullExtent():Extent
imageFormatproperty 
imageFormat:String

The output image type. Valid types are: png8 | png24 | png32 | jpg | gif. Only png and gif formats support transparency.

The default value is png8.

This property can be used as the source for data binding.


Implementation
    public function get imageFormat():String
    public function set imageFormat(value:String):void
imageTransparencyproperty 
imageTransparency:Boolean

Whether or not the background of dynamic image is transparent. Only png and gif formats support transparency.

The default value is true.

This property can be used as the source for data binding.


Implementation
    public function get imageTransparency():Boolean
    public function set imageTransparency(value:Boolean):void

See also

initialExtentproperty 
initialExtent:Extent  [read-only] [override]

Initial extent as defined by the map service. Used by the map if it is the first layer in the map and map doesn't have an extent specified.

This property can be used as the source for data binding.


Implementation
    public function get initialExtent():Extent
layerDefinitionsproperty 
layerDefinitions:Array

Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image. Definition expressions for layers that are currently not visible will be ignored by the server.

This property can be used as the source for data binding.


Implementation
    public function get layerDefinitions():Array
    public function set layerDefinitions(value:Array):void

See also


Example
ActionScript code to set definition expressions
     myDynamicLayer.layerDefinitions = [
         "STATE_FIPS = '08'",
         "STATE_FIPS = '08'",
         null, // just the group layer
         "STATE_FIPS = '08'",
         "STATE_FIPS = '08'",
         "STATE_FIPS = '08'",
         ];
layerInfosproperty 
layerInfos:Array  [read-only]

The available layers in the map service and their default visibility.

This property can be used as the source for data binding.


Implementation
    public function get layerInfos():Array

See also

layerInfoWindowRenderersproperty 
layerInfoWindowRenderers:Array

Since : ArcGIS API for Flex 2.3

Array of LayerInfoWindowRenderers that allow you to define infoWindowRenderers for specific layers [added in version 2.3].

This property can be used as the source for data binding.


Implementation
    public function get layerInfoWindowRenderers():Array
    public function set layerInfoWindowRenderers(value:Array):void

See also

layerTimeOptionsproperty 
layerTimeOptions:Array

Array of LayerTimeOptions that allow you to override how a layer is exported in reference to the map's timeExtent [added in version 2.0].

This property can be used as the source for data binding.


Implementation
    public function get layerTimeOptions():Array
    public function set layerTimeOptions(value:Array):void

See also

proxyURLproperty 
proxyURL:String

The URL to proxy the request through.

This property can be used as the source for data binding.


Implementation
    public function get proxyURL():String
    public function set proxyURL(value:String):void
requestTimeoutproperty 
requestTimeout:int

The request timeout in seconds. A value less than or equal to zero prevents request timeout.

The default value is -1.

This property can be used as the source for data binding.


Implementation
    public function get requestTimeout():int
    public function set requestTimeout(value:int):void
serviceDescriptionproperty 
serviceDescription:String  [read-only]

Map service description as defined by the map service.

This property can be used as the source for data binding.


Implementation
    public function get serviceDescription():String
spatialReferenceproperty 
spatialReference:SpatialReference  [read-only] [override]

The spatial reference of the map service.

This property can be used as the source for data binding.


Implementation
    public function get spatialReference():SpatialReference
tableInfosproperty 
tableInfos:Array  [read-only]

The stand-alone tables in the map service [added in version 2.0]. The TableInfo contains the id and name of each of these table.

This property can be used as the source for data binding.


Implementation
    public function get tableInfos():Array

See also

timeInfoproperty 
timeInfo:TimeInfo  [read-only]

Only the TimeInfo's timeExtent and timeReference properties may be available [added in version 2.0].

This property can be used as the source for data binding.


Implementation
    public function get timeInfo():TimeInfo
timeOffsetproperty 
timeOffset:Number

The time offset for the layer [added in version 2.0].

This property can be used as the source for data binding.


Implementation
    public function get timeOffset():Number
    public function set timeOffset(value:Number):void
timeOffsetUnitsproperty 
timeOffsetUnits:String

The units of the timeOffset [added in version 2.0].

This property can be used as the source for data binding.


Implementation
    public function get timeOffsetUnits():String
    public function set timeOffsetUnits(value:String):void

See also

tokenproperty 
token:String

Token for accessing a secure dynamic ArcGIS service.

This property can be used as the source for data binding.


Implementation
    public function get token():String
    public function set token(value:String):void

Example
Specifying the security token for a secured dynamic service
     <esri:ArcGISDynamicMapServiceLayer
         url="http://premium.example.com/ArcGIS/rest/services/SuperDuperMap/MapServer?token=TJd2xWZj_FAKE_1H0OHI2AtqXc91fXecait5yPUee-SbbmCbyC400_K5NVgUCz2q"
         token="TJd2xWZj_FAKE_1H0OHI2AtqXc91fXecait5yPUee-SbbmCbyC400_K5NVgUCz2q" />
     </esri:Map>
unitsproperty 
units:String  [read-only] [override]

The units of the layer. Subclasses should override this method as a best practice in case a subclassed layer is added to a map which has different "units".

This property can be used as the source for data binding.


Implementation
    public function get units():String

See also

urlproperty 
url:String

URL endpoint of a service. To obtain the URL, use ArcGIS Services Directory. An example URL for a dynamic map service is http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer.

This property can be used as the source for data binding.


Implementation
    public function get url():String
    public function set url(value:String):void
useMapTimeproperty 
useMapTime:Boolean

Since : ArcGIS API for Flex 2.2

If true and the map service is time aware, a new map image will be requested whenever the map's timeExtent changes.

The default value is true.

This property can be used as the source for data binding.


Implementation
    public function get useMapTime():Boolean
    public function set useMapTime(value:Boolean):void
versionproperty 
version:Number  [read-only]

Since : ArcGIS API for Flex 2.2

The version of ArcGIS Server where the map service is published to, for example, 9.3, 9.31, 10, 10.01 or 10.1.

This property can be used as the source for data binding.


Implementation
    public function get version():Number
visibleLayersproperty 
visibleLayers:ArrayCollection

Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in LayerInfo.

This property can be used as the source for data binding.


Implementation
    public function get visibleLayers():ArrayCollection
    public function set visibleLayers(value:ArrayCollection):void

See also

Constructor Detail
ArcGISDynamicMapServiceLayer()Constructor
public function ArcGISDynamicMapServiceLayer(url:String = null, proxyURL:String = null, token:String = null)

Creates a new ArcGISDynamicMapServiceLayer object.

Parameters
url:String (default = null) — URL to the ArcGIS Server REST resource that represents a map service.
 
proxyURL:String (default = null) — The URL to proxy the request through.
 
token:String (default = null) — Token for accessing a secure dynamic ArcGIS service.
Method Detail
defaultVisibleLayers()method
public function defaultVisibleLayers():void

Clears the visible layers as defined in visibleLayers and resets to the default layers of the map service.

exportMapImage()method 
public function exportMapImage(imageParameters:ImageParameters = null, responder:IResponder = null):AsyncToken

Exports a map using values from the layer as defaults. On completion, MapImage is returned. The mapImageExport event is also fired.

Parameters

imageParameters:ImageParameters (default = null) — Input parameters to use when exporting the map image. Non-null properties override the layer's values.
 
responder:IResponder (default = null) — IResponder to pass the MapImage result to.

Returns
AsyncToken

See also

getAllDetails()method 
public function getAllDetails(responder:IResponder = null):AsyncToken

Since : ArcGIS API for Flex 2.0

Gets the detailed information for all the ArcGIS layers and tables in the service. On completion, an AllDetails object is returned. This requires ArcGIS Server 10.0 or above.

Parameters

responder:IResponder (default = null) — IResponder to pass the AllDetails result to.

Returns
AsyncToken

See also

getDetails()method 
public function getDetails(layerOrTableId:Number, responder:IResponder = null):AsyncToken

Gets the detailed information for an ArcGIS layer or table. On completion, a LayerDetails is returned if layerOrTableId is a layer, or a TableDetails is returned if layerOrTableId is a table.

Parameters

layerOrTableId:Number — Layer ID or Table ID assigned by ArcGIS Server for a layer or table.
 
responder:IResponder (default = null) — IResponder to pass the LayerDetails or TableDetails result to.

Returns
AsyncToken

See also

getLegendInfos()method 
public function getLegendInfos(responder:IResponder = null):AsyncToken

Gets legend infos.

Parameters

responder:IResponder (default = null) — The responder to call on result or fault. The result function will be given an Array of LayerLegendInfo instances.

Returns
AsyncToken

See also

Event Detail
fault Event
Event Object Type: mx.rpc.events.FaultEvent
FaultEvent.type property = mx.rpc.events.FaultEvent.FAULT

Dispatched when getAllDetails, getDetails or exportMapImage operations fails.

getAllDetailsComplete Event  
Event Object Type: com.esri.ags.events.DetailsEvent
DetailsEvent.type property = com.esri.ags.events.DetailsEvent.GET_ALL_DETAILS_COMPLETE

Dispatched when an getAllDetails operation successfully completes.

Defines the value of the type property of an getAllDetailsComplete event object.
getDetailsComplete Event  
Event Object Type: com.esri.ags.events.DetailsEvent
DetailsEvent.type property = com.esri.ags.events.DetailsEvent.GET_DETAILS_COMPLETE

Dispatched when an getDetails operation successfully completes.

Defines the value of the type property of an getDetailsComplete event object.
mapImageExport Event  
Event Object Type: com.esri.ags.events.MapImageEvent
MapImageEvent.type property = com.esri.ags.events.MapImageEvent.EXPORT

Dispatched when an exportMapImage operation successfully completes.

Defines the value of the type property of a mapImageExport event object.