| Package | com.esri.ags |
| Class | public class Graphic |
| Inheritance | Graphic mx.core.UIComponent |
| Subclasses | ClusterGraphic |
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
See also
| Property | Defined 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 | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a new Graphic object. | Graphic | ||
refresh():void
Causes the Graphic to redraw. | Graphic | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Fires when the geometry, symbol or attributes has changed. | Graphic | |||
| attributes | property |
attributes:ObjectName-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.
public function get attributes():Object public function set attributes(value:Object):void| autoMoveToTop | property |
autoMoveToTop:BooleanIf true, this Graphic will be moved to the top of the stack on mouseOver.
The default value is true.
public function get autoMoveToTop():Boolean public function set autoMoveToTop(value:Boolean):void| checkForMouseListeners | property |
checkForMouseListeners:BooleanPrevents 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.
public function get checkForMouseListeners():Boolean public function set checkForMouseListeners(value:Boolean):void| geometry | property |
geometry:GeometryThe 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.
public function get geometry():Geometry public function set geometry(value:Geometry):void| graphicsLayer | property |
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.
public function get graphicsLayer():GraphicsLayer| infoWindowRenderer | property |
infoWindowRenderer:IFactoryThe info renderer.
public function get infoWindowRenderer():IFactory public function set infoWindowRenderer(value:IFactory):voidSee also
| symbol | property |
symbol:SymbolThe 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.
public function get symbol():Symbol public function set symbol(value:Symbol):void| Graphic | () | Constructor |
public function Graphic(geometry:Geometry = null, symbol:Symbol = null, attributes:Object = null)Creates a new Graphic object.
Parametersgeometry:Geometry (default = null) — The graphic geometry.
| |
symbol:Symbol (default = null) — The graphic symbol.
| |
attributes:Object (default = null) — The graphic attributes.
|
| refresh | () | method |
public function refresh():voidCauses the Graphic to redraw.
| change | Event |
flash.events.Eventflash.events.Event.CHANGEFires when the geometry, symbol or attributes has changed.
<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>myGraphic.toolTip = "Parcel ID: " + myGraphic.attributes.PARCEL_ID;
myGraphic.toolTip = "Name: " + myGraphic.attributes["Parcels.FullName"];