This page describes an older version, please read about the latest version at:
https://developers.arcgis.com/en/flex/api-reference/
Packagecom.esri.ags.toolbars
Classpublic class Draw
InheritanceDraw Inheritance com.esri.ags.toolbars.BaseToolbar

Toolbar that supports functionality to draw different geometries: points (MAPPOINT or MULTIPOINT), lines (LINE, POLYLINE, or FREEHAND_POLYLINE), polygons (FREEHAND_POLYGON or POLYGON), or rectangles (EXTENT). p>Note: as of version 1.2 all symbols are supported. At version 1.1 and earlier only Simplesymbols were supported.


Example
If you specify a graphicsLayer, the features will automatically be added to that graphicsLayer:
 <esri:Draw id="myDrawToolbar" map="{myMap}" graphicsLayer="{myGraphicsLayer}"
     markerSymbol="{sms}" lineSymbol="{sls}" fillSymbol="{sfs}" />

If you don't explicitly specify a graphicsLayer, you will need to add the graphic yourself (if you want it to show after you've drawn it):
 <esri:Draw id="myDrawToolbar" map="{myMap}"
     markerSymbol="{sms}" lineSymbol="{sls}" fillSymbol="{sfs}" />

See also

Live Sample - using Draw toolbar.


Public Properties
 PropertyDefined by
  fillSymbol : Symbol
The symbol for drawing polygons.
Draw
  graphicsLayer : GraphicsLayer
The graphics layer to draw the features in.
Draw
  lineSymbol : Symbol
The symbol for drawing lines.
Draw
  map : Map
The Map that the toolbar is associated with.
Draw
  markerSymbol : Symbol
The symbol for drawing points.
Draw
  respectDrawingVertexOrder : Boolean
When set to false, the geometry is modified to be topologically correct.
Draw
Public Methods
 MethodDefined by
  
Draw(map:Map = null)
Creates a new Draw object.
Draw
  
activate(drawType:String, enableGraphicsLayerMouseEvents:Boolean = false):void
Activates the toolbar for drawing geometries.
Draw
  
deactivate():void
Deactivates the toolbar and reactivates map navigation.
Draw
Events
 EventSummaryDefined by
   The drawEnd event is dispatched when the drawing is complete.Draw
   The drawStart event is dispatched when the drawing starts.Draw
Public Constants
 ConstantDefined by
  EXTENT : String = "extent"
[static] Draws an extent.
Draw
  FREEHAND_POLYGON : String = "freehandpolygon"
[static] Draws a freehand polygon.
Draw
  FREEHAND_POLYLINE : String = "freehandpolyline"
[static] Draws a freehand polyline.
Draw
  LINE : String = "line"
[static] Draws a line.
Draw
  MAPPOINT : String = "mappoint"
[static] Draws a point.
Draw
  MULTIPOINT : String = "multipoint"
[static] Draws a multipoint.
Draw
  POLYGON : String = "polygon"
[static] Draws a polygon.
Draw
  POLYLINE : String = "polyline"
[static] Draws a polyline.
Draw
Property detail
fillSymbolproperty
fillSymbol:Symbol  [read-write]

The symbol for drawing polygons.

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

Implementation
    public function get fillSymbol():Symbol
    public function set fillSymbol(value:Symbol):void
graphicsLayerproperty 
graphicsLayer:GraphicsLayer  [read-write]

The graphics layer to draw the features in.

Implementation
    public function get graphicsLayer():GraphicsLayer
    public function set graphicsLayer(value:GraphicsLayer):void
lineSymbolproperty 
lineSymbol:Symbol  [read-write]

The symbol for drawing lines.

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

Implementation
    public function get lineSymbol():Symbol
    public function set lineSymbol(value:Symbol):void
mapproperty 
map:Map  [read-write]

The Map that the toolbar is associated with.

Implementation
    public function get map():Map
    public function set map(value:Map):void
markerSymbolproperty 
markerSymbol:Symbol  [read-write]

The symbol for drawing points.

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

Implementation
    public function get markerSymbol():Symbol
    public function set markerSymbol(value:Symbol):void
respectDrawingVertexOrderproperty 
respectDrawingVertexOrder:Boolean  [read-write]

When set to false, the geometry is modified to be topologically correct. When set to true, the input geometry is not modified.

The default value is false.

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

Implementation
    public function get respectDrawingVertexOrder():Boolean
    public function set respectDrawingVertexOrder(value:Boolean):void
Constructor detail
Draw()constructor
public function Draw(map:Map = null)

Creates a new Draw object.

Parameters
map:Map (default = null) — The Map that the toolbar should be associated with.
Method detail
activate()method
public function activate(drawType:String, enableGraphicsLayerMouseEvents:Boolean = false):void

Activates the toolbar for drawing geometries. Activating the toolbar disables map navigation. The property map has to be set for the activate method to complete.

Parameters
drawType:String — The draw type. One of either MAPPOINT, MULTIPOINT, EXTENT, LINE, POLYLINE, POLYGON, FREEHAND_POLYLINE or FREEHAND_POLYGON.
 
enableGraphicsLayerMouseEvents:Boolean (default = false) — If true, allows GraphicsLayer to listen for MouseEvents while toolbar is active.
deactivate()method 
public function deactivate():void

Deactivates the toolbar and reactivates map navigation.

Event detail
drawEndevent 
Event object type: com.esri.ags.events.DrawEvent
DrawEvent.type property = com.esri.ags.events.DrawEvent.DRAW_END

The drawEnd event is dispatched when the drawing is complete.

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

drawStartevent  
Event object type: com.esri.ags.events.DrawEvent
DrawEvent.type property = com.esri.ags.events.DrawEvent.DRAW_START

The drawStart event is dispatched when the drawing starts.

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

Constant detail
EXTENTconstant
public static const EXTENT:String = "extent"

Draws an extent.

FREEHAND_POLYGONconstant 
public static const FREEHAND_POLYGON:String = "freehandpolygon"

Draws a freehand polygon.

FREEHAND_POLYLINEconstant 
public static const FREEHAND_POLYLINE:String = "freehandpolyline"

Draws a freehand polyline.

LINEconstant 
public static const LINE:String = "line"

Draws a line.

MAPPOINTconstant 
public static const MAPPOINT:String = "mappoint"

Draws a point.

MULTIPOINTconstant 
public static const MULTIPOINT:String = "multipoint"

Draws a multipoint.

POLYGONconstant 
public static const POLYGON:String = "polygon"

Draws a polygon.

POLYLINEconstant 
public static const POLYLINE:String = "polyline"

Draws a polyline.