Packagecom.esri.ags
Classpublic class Graphic
InheritanceGraphic Inheritance mx.core.UIComponent

Any feature that can contain geometry, a symbol, attributes and an infoWindowRenderer. 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


Example
MXML to display two points as Graphics on a map:
 <esri:Map>
     <esri:ArcGISTiledMapServiceLayer
         url="http://server.arcgisonline.com/ArcGIS/rest/services/NPS_Physical_World_2D/MapServer" />
     <esri:GraphicsLayer>
         <esri:Graphic>
             <esri:geometry>
                 <esri:MapPoint x="13" y="55.59" spatialReference="{new SpatialReference(4326)}"/>
             </esri:geometry>
         </esri:Graphic>
         <esri:Graphic>
             <esri:geometry>
                 <esri:MapPoint x="35.51" y="33.87" spatialReference="{new SpatialReference(4326)}"/>
             </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"];

See also

com.esri.ags.layers.GraphicsLayer
com.esri.ags.geometry
com.esri.ags.symbol
http://livedocs.adobe.com/flex/3/langref/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
  infoWindowRenderer : IFactory
The infoWindowRenderer is a UIComponent factory that is added to a graphic.
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
 EventSummaryDefined by
   Fires when the geometry, symbol or attributes has changed.Graphic
Property detail
attributesproperty
attributes:Object  [read-write]

Name-value pairs of fields and field values associated with the graphic. If the attributes class is an IEventDispatcher, the Graphic will listen for PropertyChangeEvent.PROPERTY_CHANGE events on the attributes and it'll refresh when they occur. 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  [read-write]

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

The default value is true.

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

Implementation
    public function get autoMoveToTop():Boolean
    public function set autoMoveToTop(value:Boolean):void
checkForMouseListenersproperty 
checkForMouseListeners:Boolean  [read-write]

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.

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

Implementation
    public function get checkForMouseListeners():Boolean
    public function set checkForMouseListeners(value:Boolean):void
geometryproperty 
geometry:Geometry  [read-write]

The geometry that defines the graphic. If the geometry class is an IEventDispatcher, the Graphic will listen for Event.CHANGE events on the geometry and it'll refresh when they occur.

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

Implementation
    public function get geometry():Geometry
    public function set geometry(value:Geometry):void
infoWindowRendererproperty 
infoWindowRenderer:IFactory  [read-write]

The infoWindowRenderer is a UIComponent factory that is added to a graphic. Wen infoWindowRenderer is defined on a graphic, a mouse "click" listener is automatically added to the graphic. When graphic is clicked, a UIComponent instance is created using the factory and if that factory implements the IDataRenderer interface then its data property is set to the graphic attributes. In addition, if the UIComponent has a dataProvider property, then that property is set to the graphic attributes as well. Finally, the map info window content is set to the newly created UIComponent and is shown at an anchor location. If the geometry of the graphic is a map point, then the anchor location will be that map point, otherwise the anchor point will be where the user clicked map point location.

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

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

See also

symbolproperty 
symbol:Symbol  [read-write]

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
changeevent 
Event object type: flash.events.Event

Fires when the geometry, symbol or attributes has changed.