| Package | com.esri.ags |
| Class | public class Graphic |
| Inheritance | Graphic mx.core.UIComponent |
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
<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>myGraphic.toolTip = "Parcel ID: " + myGraphic.attributes.PARCEL_ID;
myGraphic.toolTip = "Name: " + myGraphic.attributes["Parcels.FullName"];
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 | ||
| infoWindowRenderer : IFactory
The infoWindowRenderer is a UIComponent factory that is added to a graphic.
| 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: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
| autoMoveToTop | property |
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
| checkForMouseListeners | property |
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
| geometry | property |
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
| infoWindowRenderer | property |
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
| symbol | property |
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
| 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 |