Packagecom.google.maps.overlays
Classpublic class Marker
Implementsflash.events.IEventDispatcher, IMarker

A Marker object marks a position on the map. It implements the IOverlay interface and can be added to the map using the Map.addOverlay() method.
A marker is associated with a latlng, which determines the geographical position where its icon is anchored on the map.
It can either render a default icon or display a custom icon provided by a developer. A custom icon (or rendering options for the standard icon) may be specified using the Marker.setOptions() method.



Public Properties
 PropertyDefined by
  foreground : DisplayObject
[read-only] Display object that represents the overlay's content.
Marker
  pane : IPane
Pane this overlay resides on (null if the overlay is not added to the map).
Marker
  shadow : DisplayObject
[read-only] Display object that represents the overlay's shadow (null if the overlay never has a shadow).
Marker
  visible : Boolean
Visibility of the overlay.
Marker
Public Methods
 MethodDefined by
  
Marker(latLng:LatLng, options:MarkerOptions = null)
Constructs a new marker at the specified lat-lng, with the specified options.
Marker
  
Closes the info window if it is associated with this marker.
Marker
  
Retrieves the default pane that this overlay should be placed on if none is explicitly specified (when the overlay is added through the IMap.addOverlay() call).
Marker
  
Retrieves the location of the marker.
Marker
  
Retrieves the full set of options used by the marker.
Marker
  
Opens an information window above the marker.
Marker
  
positionOverlay(zoomChanged:Boolean):void
Reposition the overlay on the screen.
Marker
  
setLatLng(value:LatLng):void
Changes the LatLng of the marker.
Marker
  
setOptions(options:MarkerOptions):void
Updates the marker options.
Marker
Protected Methods
 MethodDefined by
  
clearWrapper():void
Remove all event listeners and clear the wrapper.
Marker
Property detail
foregroundproperty
foreground:DisplayObject  [read-only]

Display object that represents the overlay's content.

Implementation
    public function get foreground():DisplayObject
paneproperty 
pane:IPane  [read-write]

Pane this overlay resides on (null if the overlay is not added to the map). This property value is set by the map when the overlay is added to or removed from the map and should not be modified by the developers.

Implementation
    public function get pane():IPane
    public function set pane(value:IPane):void
shadowproperty 
shadow:DisplayObject  [read-only]

Display object that represents the overlay's shadow (null if the overlay never has a shadow).

Implementation
    public function get shadow():DisplayObject
visibleproperty 
visible:Boolean  [read-write]

Visibility of the overlay.

Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
Constructor detail
Marker()constructor
public function Marker(latLng:LatLng, options:MarkerOptions = null)

Constructs a new marker at the specified lat-lng, with the specified options.

Parameters
latLng:LatLng — Marker location.
 
options:MarkerOptions (default = null) — Full or partial set of marker options. When a partial set of options is specified, the marker's complete set of options will be a combination of partial options and the existing defaults set using MarkerOptions.setDefaultOptions() call.

See also

Method detail
clearWrapper()method
protected function clearWrapper():void

Remove all event listeners and clear the wrapper.

closeInfoWindow()method 
public function closeInfoWindow():void

Closes the info window if it is associated with this marker.

getDefaultPane()method 
public function getDefaultPane(map:IMap):IPane

Retrieves the default pane that this overlay should be placed on if none is explicitly specified (when the overlay is added through the IMap.addOverlay() call).

Parameters
map:IMap — Instance of map that this overlay is added to.

Returns
IPane — Instance of IPane to which the overlay will be added by default.
getLatLng()method 
public function getLatLng():LatLng

Retrieves the location of the marker.

Returns
LatLng — LatLng of the marker.
getOptions()method 
public function getOptions():MarkerOptions

Retrieves the full set of options used by the marker. Use the setOptions method to modify the options on the marker.

Returns
MarkerOptions — Options used by the marker.

See also

Marker.setOptions()
openInfoWindow()method 
public function openInfoWindow(options:InfoWindowOptions = null):IInfoWindow

Opens an information window above the marker.

Parameters
options:InfoWindowOptions (default = null) — InfoWindow options.

Returns
IInfoWindow — Reference to newly created info window.
positionOverlay()method 
public function positionOverlay(zoomChanged:Boolean):void

Reposition the overlay on the screen. This method is called in response to changes in the position (centre) of the map and/or the map's zoom level. Developers should not call the method themselves. The implementation of this method should either change the position of the overlay on the screen in response to the change of the map's centre or redraw the overlay completely if it needs to be reconfigured for a different map centre/zoom level. Repositioning of the overlay should be done by changing the placement of the overlay's display object on its pane using the mappings provided by the IPane interface (fromLatLngToPaneCoords or fromProjectionPointToPaneCoords).

Parameters
zoomChanged:Boolean — Whether the zoom level of the map has changed or the call was invoked just as a result of a map pan.
setLatLng()method 
public function setLatLng(value:LatLng):void

Changes the LatLng of the marker.

Parameters
value:LatLng — New LatLng location of the marker.
setOptions()method 
public function setOptions(options:MarkerOptions):void

Updates the marker options. The options parameter may specify a complete or partial set of marker options. If a partial set of options is specified, it will supplement the existing marker options, overriding only the values that were set explicitly and leaving the rest unchanged.

Parameters
options:MarkerOptions — New full or partial set of options for the marker.

Example
Modify the marker's fill colour, leaving the rest of its options unchanged.
   var options:MarkerOptions =
       new MarkerOptions( { fillStyle: { color: 0x000080 }} );
   myMarker.setOptions(options);