This page describes an older version, please see latest API at http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/Graphic.html.
Packagecom.esri.ags
Classpublic class Graphic
InheritanceGraphic Inheritance mx.core.UIComponent
Subclasses ClusterGraphic

Any feature that can contain geometry, a symbol, attributes and an infoTemplate. Tasks return feature results as Graphics. A Graphic can also be created on the client such as to display the location clicked on a map. This Graphic can be sent to the server as input to a task.

Note that Graphics extends 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, mouseEnabled, toolTip and visible.

Default MXML Propertygeometry

View the examples

See also

com.esri.ags.layers.GraphicsLayer
com.esri.ags.geometry
com.esri.ags.symbols
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIComponent.html
Concepts - Using Graphic


Public Properties
 PropertyDefined By
  attributes : Object
Name-value pairs of fields and field values associated with the graphic.
Graphic
  autoMoveToTop : Boolean
If true, this Graphic will be moved to the top of the stack on mouseOver.
Graphic
  checkForMouseListeners : Boolean
Prevents the map from zooming and panning when the mouse is over the graphic and the graphic has registered mouse listeners.
Graphic
  geometry : Geometry
The geometry that defines the graphic.
Graphic
  graphicsLayer : GraphicsLayer
[read-only] Return the parent as an instance of GraphicsLayer.
Graphic
  infoWindowRenderer : IFactory
The info renderer.
Graphic
  symbol : Symbol
The symbol for the graphic.
Graphic
Public Methods
 MethodDefined By
  
Graphic(geometry:Geometry = null, symbol:Symbol = null, attributes:Object = null)
Creates a new Graphic object.
Graphic
  
refresh():void
Causes the Graphic to redraw.
Graphic
Events
 Event Summary Defined By
  Fires when the geometry, symbol or attributes has changed.Graphic
Property Detail
attributesproperty
attributes:Object

Name-value pairs of fields and field values associated with the graphic. If the attributes class is an IEventDispatcher, the Graphic will refresh itself when PropertyChangeEvent.PROPERTY_CHANGE events on the attributes are thrown. This is the default event type thrown from bindable properties.

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


Implementation
    public function get attributes():Object
    public function set attributes(value:Object):void
autoMoveToTopproperty 
autoMoveToTop:Boolean

If true, this Graphic will be moved to the top of the stack on mouseOver.

The default value is true.


Implementation
    public function get autoMoveToTop():Boolean
    public function set autoMoveToTop(value:Boolean):void
checkForMouseListenersproperty 
checkForMouseListeners:Boolean

Prevents the map from zooming and panning when the mouse is over the graphic and the graphic has registered mouse listeners. The map mouse handler checks for MOUSE_DOWN, MOUSE_MOVE, MOUSE_UP, MOUSE_CLICK, MOUSE_DOUBLECLICK event listeners. This comes in handy when you have a large polygon on the map and that polygon has a mouse listener but you still want to pan the map while holding down the mouse over the polygon.

The default value is true.


Implementation
    public function get checkForMouseListeners():Boolean
    public function set checkForMouseListeners(value:Boolean):void
geometryproperty 
geometry:Geometry

The geometry that defines the graphic. If the geometry class is an IEventDispatcher, the Graphic will refresh itself when Event.CHANGE events on the geometry are thrown.

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


Implementation
    public function get geometry():Geometry
    public function set geometry(value:Geometry):void
graphicsLayerproperty 
graphicsLayer:GraphicsLayer  [read-only]

Return the parent as an instance of GraphicsLayer. Can return null if the graphic was not added to a graphics layer. A graphic can belong to only _one_ layer. To move it from one graphics layer to another, it has to be explicitly removed from one layer and added to another.


Implementation
    public function get graphicsLayer():GraphicsLayer
infoWindowRendererproperty 
infoWindowRenderer:IFactory

The info renderer.


Implementation
    public function get infoWindowRenderer():IFactory
    public function set infoWindowRenderer(value:IFactory):void

See also

symbolproperty 
symbol:Symbol

The symbol for the graphic. If no symbol is specified on the graphic, the symbol will be taken from the symbol or symbolFunction of the layer. If no symbol is specified on neither graphic nor layer, the default symbol will be used.

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


Implementation
    public function get symbol():Symbol
    public function set symbol(value:Symbol):void
Constructor Detail
Graphic()Constructor
public function Graphic(geometry:Geometry = null, symbol:Symbol = null, attributes:Object = null)

Creates a new Graphic object.

Parameters
geometry:Geometry (default = null) — The graphic geometry.
 
symbol:Symbol (default = null) — The graphic symbol.
 
attributes:Object (default = null) — The graphic attributes.
Method Detail
refresh()method
public function refresh():void

Causes the Graphic to redraw.

Event Detail
change Event
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.CHANGE

Fires when the geometry, symbol or attributes has changed.

Examples
MXML to display two points as Graphics on a map:
 <esri:Map>
     <esri:ArcGISTiledMapServiceLayer
         url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer" />
     <esri:GraphicsLayer>
         <esri:Graphic>
             <esri:geometry>
                 <esri:MapPoint x="1447000" y="7477000" spatialReference="{new SpatialReference(102100)}"/>
             </esri:geometry>
         </esri:Graphic>
         <esri:Graphic>
             <esri:geometry>
                 <esri:MapPoint x="3952000" y="4011000" spatialReference="{new SpatialReference(102100)}"/>
             </esri:geometry>
         </esri:Graphic>
     </esri:GraphicsLayer>
 </esri:Map>
ActionScript to set the toolTip on a Graphic:
 myGraphic.toolTip = "Parcel ID: " + myGraphic.attributes.PARCEL_ID;
ActionScript to set the toolTip using an attribute from a joined table (or whenever the attribute name has special characters):
 myGraphic.toolTip = "Name: " + myGraphic.attributes["Parcels.FullName"];