English | Site Directory

Google Maps API for Flash

Google Maps for Enterprise

Includes enterprise licensing and support

Google Maps API ActionScript Reference

  1. com.google.maps
    1. Alpha
    2. Color
    3. Copyright
    4. CopyrightCollection
    5. CopyrightNotice
    6. InfoWindowOptions
    7. LatLng
    8. LatLngBounds
    9. Map
    10. MapAction
    11. MapEvent
    12. MapMouseEvent
    13. MapMoveEvent
    14. MapType
    15. MapTypeOptions
    16. MapZoomEvent
    17. PaneId
    18. ProjectionBase
    19. TileLayerBase
  1. com.google.maps.interfaces
    1. IControl
    2. ICopyrightCollection
    3. IDirections
    4. IGroundOverlay
    5. IInfoWindow
    6. IMap
    7. IMapType
    8. IMarker
    9. IOverlay
    10. IPane
    11. IPaneManager
    12. IPolygon
    13. IPolyline
    14. IProjection
    15. ITileLayer
    16. IWrappable
    17. IWrappableEventDispatcher
  1. com.google.maps.services
    1. ClientGeocoder
    2. Directions
    3. DirectionsEvent
    4. DirectionsOptions
    5. GeocodingEvent
    6. GeocodingResponse
    7. Placemark
    8. Route
    9. ServiceStatus
    10. Step
  1. com.google.maps.controls
    1. ControlBase
    2. ControlPosition
    3. MapTypeControl
    4. MapTypeControlOptions
    5. OverviewMapControl
    6. OverviewMapControlOptions
    7. PositionControl
    8. PositionControlOptions
    9. ZoomControl
    10. ZoomControlOptions
  1. com.google.maps.overlays
    1. EncodedPolylineData
    2. GroundOverlay
    3. GroundOverlayOptions
    4. Marker
    5. MarkerOptions
    6. OverlayBase
    7. Polygon
    8. PolygonOptions
    9. Polyline
    10. PolylineOptions
  1. com.google.maps.styles
    1. BevelStyle
    2. ButtonFaceStyle
    3. ButtonStyle
    4. FillStyle
    5. GradientStyle
    6. RectangleStyle
    7. StrokeStyle

class Alpha

Fields

OPAQUE, PERCENT_0, PERCENT_10, PERCENT_100, PERCENT_20, PERCENT_30, PERCENT_40, PERCENT_50, PERCENT_60, PERCENT_70, PERCENT_80, PERCENT_90, UNSEEN

Alpha (opacity) constants. The main role of these constants is to improve code readability, using names that immediately suggest the effect that the chosen opacity value has.

Constants

Name Value Description
OPAQUE 1.00
PERCENT_0 0
PERCENT_10 0.10
PERCENT_100 1.00
PERCENT_20 0.20
PERCENT_30 0.30
PERCENT_40 0.40
PERCENT_50 0.50
PERCENT_60 0.60
PERCENT_70 0.70
PERCENT_80 0.80
PERCENT_90 0.90
UNSEEN 0

Back to top

class Color

Fields

BLACK, BLUE, CYAN, DEFAULTLINK, GRAY1, GRAY10, GRAY11, GRAY12, GRAY13, GRAY14, GRAY15, GRAY2, GRAY3, GRAY4, GRAY5, GRAY6, GRAY7, GRAY8, GRAY9, GREEN, MAGENTA, RED, WHITE, YELLOW, b, g, r, rgb

Constructors

Color

Methods

incRGB, setRGB, toHtml, toString

Color stores a color and provides methods for conversion between different textual and numeric representations of color.

Constants

Name Value Description
BLACK 0x000000
BLUE 0x0000ff
CYAN 0x00ffff
GRAY1 0x101010
GRAY10 0xa0a0a0
GRAY11 0xb0b0b0
GRAY12 0xc0c0c0
GRAY13 0xd0d0d0
GRAY14 0xe0e0e0
GRAY15 0xf0f0f0
GRAY2 0x202020
GRAY3 0x303030
GRAY4 0x404040
GRAY5 0x505050
GRAY6 0x606060
GRAY7 0x707070
GRAY8 0x808080
GRAY9 0x909090
GREEN 0x00ff00
MAGENTA 0xff00ff
RED 0xff0000
WHITE 0xffffff
YELLOW 0xffff00

Properties

Name Type Description
b Number

Blue component, in the range [0,255].

g Number

Green component, in the range [0,255].

r Number

Red component, in the range [0,255].

rgb Number

Color as a Number, for example 0x804020.

Constructors

Color(clr:Number)

Constructs a Color from a Number.

var col:Color = new Color(0x0000ff);  // blue
Parameter Type Description
clr Number

Static Methods

static String toHtml(color:Number)

Returns a color in HTML format, for example '#321fba'. Clamps the number to the range [0x000000,0xffffff]. Returns the encoding for black if the input value is not a valid number.

var col:Color = new Color(0xff8020);
trace(col.toHtml());  // outputs "#ff8020"
Parameter Type Description
color Number

Color to represent in HTML format.

Instance Methods

void incRGB(deltaR:Number, deltaG:Number, deltaB:Number)

Increments this color's R, G and B components by individual delta values. Each color component is clamped to the valid range [0,255].

var col:Color = new Color(0xff0000);  // color is red
col.incRGB(0, 255, 0);  // color is now yellow
Parameter Type Description
deltaR Number

R component delta.

deltaG Number

G component delta.

deltaB Number

B component delta.

void setRGB(compR:Number, compG:Number, compB:Number)

Sets this color from R, G and B components, all in the range [0,255].

var col:Color = new Color(0);
col.setRGB(128, 64, 255);  // lilac
Parameter Type Description
compR Number

New R component.

compG Number

New G component.

compB Number

New B component.

String toString()

Returns a string representation of this color, for example 'R:64/G:32/B:255'.

var col:Color = new Color(0xff8020);
trace(col.toString());  // outputs "R:255/G:128/B:32"

Back to top

Constructors

Copyright

Methods

getBounds, getId, getMaxZoom, getMinZoom, getText, isSupplemental

This class contains information about which copyright message applies to a region of the map given by a rectangle, at a given range of zoom levels. You need this object only if you implement custom map types or tile layers.

Constructors

Copyright(id:String, bounds:LatLngBounds, minZoom:Number, text:String, opt_maxZoom:Number, opt_isSupplemental:Boolean)

Constructs a Copyright instance covering a geographical extent and range of zoom levels and specifies the id and text displayed for this instance.

// Create two Copyright instances. Company A's data is used
// throughout all zoom levels over a region spanning 10 degrees of latitude
// and 40 degrees of longitude. Company B's data supplements this over a
// much smaller region at zoom levels 14 and higher.
var regionCopyright:Copyright = new Copyright(
    'my_tileset_0',
    new LatLngBounds(new LatLng(10, 20), new LatLng(20, 60)),
    'Company A',
    0);
var cityCopyright:Copyright = new Copyright(
    'my_tileset_1',
    new LatLngBounds(new LatLng(12, 20), new LatLng(13, 21)),
    'Company B',
    14,
    true);
Parameter Type Description
id String

Unique id.

bounds LatLngBounds

Geographical extent to which this Copyright applies.

minZoom Number

Minimum zoom at which to display.

text String

Copyright text.

opt_maxZoom Number

Maximum zoom at which to display.

opt_isSupplemental Boolean

Indicates whether this copyright supplements copyrights from coarser zoom levels. You might specify a general copyright over an extended region at a coarse zoom level, then add further copyright text within part of this region at a finer zoom level by setting this flag true. Alternatively, you may simply leave this false and specify the entire text at the finer zoom level.

Instance Methods

LatLngBounds getBounds()

Retrieves the spatial extent of the copyright.

var regionCopyright:Copyright = new Copyright(
    'my_tileset_0',
    new LatLngBounds(new LatLng(10, 20), new LatLng(20, 60)),
    'Company A',
    0);
trace(regionCopyright.getBounds());  // outputs "((10, 20), (20, 60))"

String getId()

Retrieves the copyright id.

Number getMaxZoom()

Retrieves the maximum zoom level that applies to the copyright.

Number getMinZoom()

Retrieves the minimum zoom level that applies to the copyright.

String getText()

Retrieves the copyright text.

Boolean isSupplemental()

Returns true if this copyright is supplemental to copyright information from coarser zoom levels. If it is supplemental then it will be added to the coarser zoom level copyright information. If it is not supplemental then this copyright information is fully self-contained.

Back to top

class CopyrightCollection

Implements

ICopyrightCollection

Constructors

CopyrightCollection

Methods

addCopyright, getCopyrightNotice, getCopyrights, getCopyrightsAtLatLng

CopyrightCollection manages copyright messages displayed on maps of custom map type. If you don't implement custom map types, then you don't need to use this class. A copyright collection contains information about which copyright to display for which region on the map at which zoom level. This is very important for map types that display heterogenous data such as the satellite map type.

Constructors

CopyrightCollection(opt_prefix:String)

Creates a copyright collection for the given map type/spec.

Parameter Type Description
opt_prefix String

Prefix for copyrights (optional).

Instance Methods

Boolean addCopyright(copyright:Copyright)

Adds the given copyright to the collection, returning true if the copyright was new and was added or false if the copyright was a duplicate and ignored.

Parameter Type Description
copyright Copyright

New copyright to add.

CopyrightNotice getCopyrightNotice(bounds:LatLngBounds, zoom:Number)

Returns a CopyrightNotice instance for the given viewport.

Parameter Type Description
bounds LatLngBounds

Query bounds.

zoom Number

Zoom level.

Array getCopyrights(bounds:LatLngBounds, zoom:Number)

Retrieves an array of elements of type String, which comprises the copyright text that we should display for the given viewport.

Parameter Type Description
bounds LatLngBounds

Query bounds.

zoom Number

Zoom level.

Array getCopyrightsAtLatLng(latLng:LatLng)

Returns an array of elements of type Copyright, which are the copyrights pertaining to the specified location.

Parameter Type Description
latLng LatLng

The point for which we want to get copyrights for.

Back to top

class CopyrightNotice

Constructors

CopyrightNotice

Methods

getPrefix, getTexts, toString

CopyrightNotice stores an array of strings representing copyright text to display on the map, but can also be cast to a single text string. Copyright information for several data providers may apply to a region of the map: maintaining an array allows the text for the individual providers to be extracted. Use the toString method if you wish simply to obtain a single compound text string. You are unlikely to need to construct a CopyrightNotice yourself, but ICopyrightCollection provides a method, getCopyrightNotice() that returns an instance of this class.

Constructors

CopyrightNotice(prefix:String, copyrightTexts:Array)

Construct a CopyrightNotice from a text prefix and an array of elements of type String representing the individual copyright notices. Note that this class stores a reference to this array, rather than cloning the elements.

Parameter Type Description
prefix String

Copyright prefix.

copyrightTexts Array

Text of each copyright.

Instance Methods

String getPrefix()

Retrieves the copyright prefix.

Array getTexts()

Retrieves the array of copyright texts. Each element in this array is of type String.

String toString()

Returns a single string made up of the prefix followed by a list of the text array elements.

var notice:CopyrightNotice = new CopyrightNotice(
    "Copyright",
    [ "Company A", "Company B" ]);
trace(notice.toString());  // outputs "Copyright Company A, CompanyB"

Back to top

class InfoWindowOptions

Fields

ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, content, contentFormat, contentHTML, contentStyleSheet, cornerRadius, customCloseRect, customContent, customOffset, drawDefaultFrame, fillStyle, hasCloseButton, hasShadow, hasTail, height, padding, pointOffset, strokeStyle, tailAlign, tailHeight, tailOffset, tailWidth, title, titleFormat, titleHTML, titleStyleSheet, width

Constructors

InfoWindowOptions

Methods

getDefaultOptions, setDefaultOptions, toString

Class InfoWindowOptions specifies a set of rendering parameters for the info window.

Constants

Name Value Description
ALIGN_CENTER 1
ALIGN_LEFT 0
ALIGN_RIGHT 2

Properties

Name Type Description
content String

Plain text content for the info window.

contentFormat TextFormat

Info window's content format.

contentHTML String

HTML content for the info window.

contentStyleSheet StyleSheet

Info window's content style sheet.

cornerRadius Object

A Number value that indicates the info window's corner radius.

customCloseRect Rectangle

Custom close rectangle. If non-null, this parameter specifies the rectangular region within which a mouse-click will close the info window. When the customContent property is also non-null this region is invisible but still active. When using custom content you are, of course, free to attach mouse listeners within your own content and could use one of these to close the info window; this property provides an alternative. When the customContent property is null the customCloseRect property can be used to move the close button from its default location.

customContent DisplayObject

Display object used as the info window's custom content. If this field is not null then nothing is drawn by the Maps API for Flash library, but rather the custom content is positioned relative to the info window anchor point.

customOffset Point

Custom content offset. When custom content is used, this parameter specifies the offset of the infowindow's target location in relation to the customContent's alignment point. This property has no effect if customContent is not specified or if drawDefaultFrame is set to true.

drawDefaultFrame Object

A Boolean value indicating whether the default infowindow outline (including the default close button) should be drawn around the custom content specified through the customContent property. The default infowindow outline is always drawn if the custom content is not specified.

fillStyle FillStyle

Info window's fill style.

hasCloseButton Object

A Boolean value that indicates whether the info window has a close button.

hasShadow Object

A Boolean value that indicates whether the info window has a shadow.

hasTail Object

A Boolean value that indicates whether the info window has a tail.

height Object

A Number value that indicates the info window's height.

padding Object

A Number value that indicates the padding applied around the info window's title and content.

pointOffset Point

Offset of the tail point from the info window anchor.

strokeStyle StrokeStyle

Info window's stroke style.

tailAlign Object

A Number value that specifies the tail alignment. Set this to one of the constants InfoWindowOptions.ALIGN_LEFT, InfoWindowOptions.ALIGN_CENTER or InfoWindowOptions.ALIGN_RIGHT.

tailHeight Object

A Number value that indicates the tail's height.

tailOffset Object

A Number value that indicates the horizontal offset of the tail's tip from the info window midpoint.

tailWidth Object

A Number value that indicates the tail's width.

title String

Plain text title for the info window.

titleFormat TextFormat

Info window's title format.

titleHTML String

HTML title for the info window.

titleStyleSheet StyleSheet

Info window's title style sheet.

width Object

A Number value that indicates the info window's width.

Constructors

InfoWindowOptions(param:Object)

Constructs an InfoWindowOptions object, optionally initializing it from an object.

// Specifying all InfoWindowOptions properties.
var titleFormat:TextFormat = new TextFormat();
textFormat.bold = true;
var titleStyleSheet:StyleSheet = new StyleSheet();
var h1:Object = {
  color: "#FFFF80",
  fontWeight: "bold" };
titleStyleSheet.setStyle("h1", h1);
var contentStyleSheet:StyleSheet = new StyleSheet();
var body:Object = {
  color: "#FF0080",
  fontStyle: "italic" };
contentStyleSheet.setStyle("body", body);
var contentFormat:TextFormat = new TextFormat("Arial", 10);
var options:InfoWindowOptions = new InfoWindowOptions({
  strokeStyle: {
    color: 0x987654
  },
  fillStyle: {
    color: 0x223344,
    alpha: 0.8
  },
  titleFormat: titleFormat,
  titleStyleSheet: titleStyleSheet,
  contentFormat: contentFormat,
  contentStyleSheet: contentStyleSheet,
  width: 200,
  cornerRadius: 12,
  padding: 10,
  hasCloseButton: true,
  hasTail: true,
  tailWidth: 20,
  tailHeight: 30,
  tailOffset: -12,
  tailAlign: InfoWindowOptions.ALIGN_LEFT,
  pointOffset: new Point(3, 8),
  hasShadow: true
});
Parameter Type Description
param Object

An object that contains a set of initial values for the new InfoWindowOptions object. The fields are: strokeStyle:StrokeStyle fillStyle:FillStyle title:String titleHTML:String titleFormat:TextFormat titleStyleSheet:StyleSheet content:String contentHTML:String contentFormat:TextFormat contentStyleSheet:StyleSheet width:Object height:Object cornerRadius:Object padding:Object hasCloseButton:Object hasTail:Object tailWidth:Object tailHeight:Object tailOffset:Object tailAlign:Object pointOffset:Point hasShadow:Object

Static Methods

static InfoWindowOptions getDefaultOptions()

Retrieves the InfoWindowOptions instance that represents the default set of options that applies to all info windows.

// Initialization object corresponding to the initial defaults.
var titleStyleSheet:StyleSheet = new StyleSheet();
titleStyleSheet.setStyle("p", { fontFamily: "_sans" });
var contentStyleSheet:StyleSheet = new StyleSheet();
contentStyleSheet.setStyle("p", { fontFamily: "_sans" });
var initObject:Object = {
  strokeStyle: {
    thickness: 2,
    alpha: 1.0,
    color:Color.BLACK
  },
  fillStyle: {
    color: 0xffffff,
    alpha: 1.0
  },
  title: null,
  titleHTML: null,
  titleFormat: new TextFormat("_sans"),
  titleStyleSheet: titleStyleSheet,
  content: null,
  contentHTML: null,
  contentFormat: new TextFormat("_sans"),
  contentStyleSheet: contentStyleSheet,
  width: 200,
  height: null,
  cornerRadius: 5,
  padding: 0,
  hasCloseButton: true,
  hasTail: true,
  tailWidth: 20,
  tailHeight: 20,
  tailOffset: 0,
  tailAlign: InfoWindowOptions.ALIGN_LEFT,
  pointOffset: new Point(0, 0),
  hasShadow: true,
  customContent: null,
  customOffset: null,
  customCloseRect: null
}

static void setDefaultOptions(defaults:InfoWindowOptions)

Sets the default set of options that applies to all infowindows. Options may also be set for the infowindow individually in the openInfoWindow call. If that is the case, options specified in that call will take precedence over the default options. The defaults parameter may specify a complete or partial set of infowindow options. If a partial set of options is specified, it will supplement the existing defaults, overriding only the values that were set explicitly and leaving the rest unchanged.

Parameter Type Description
defaults InfoWindowOptions

New default full or partial set of infowindow options.

Instance Methods

String toString()

Returns a String representation of this object.

Back to top

class LatLng

Fields

EARTH_RADIUS

Constructors

LatLng

Methods

angleFrom, clone, distanceFrom, equals, fromRadians, fromUrlValue, lat, latRadians, lng, lngRadians, toString, toUrlValue

LatLng is a point in geographical coordinates with longitude and latitude. Notice that although usual map projections associate longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude coordinate is always written first, followed by the longitude, as is customary in cartography. Notice also that you cannot modify the coordinates of a LatLng. If you want to compute another point, you have to create a new one.

Constants

Name Value Description
EARTH_RADIUS 6378137

The equatorial radius of the earth in meters. Assumes a perfectly spherical earth, and hence is approximate. The earth's radius in fact varies between 6357 km at the pole to 6378 KM at the equator - a difference of 0.3%.

Constructors

LatLng(lat:Number, lng:Number, opt_noCorrect:Boolean)

Constructs a LatLng. If opt_noCorrect is false, we make sure the latitude and longitude are valid, wrapping the longitude appropriately around the dateline and clamping the latitude at the poles. Valid values for longitude lie in the range [-180,180). Valid values for latitude lie in the range [-90,90].

// Construct three LatLng instances.
var sydney:LatLng = new LatLng(-33.8581, 151.2149);
var bound:LatLng = new LatLng(10, 190);  // longitude set to -170
var unbound:LatLng = new LatLng(10, 190, true);  // longitude set to 190
Parameter Type Description
lat Number

Latitude.

lng Number

Longitude.

opt_noCorrect Boolean

Flag: do not correct to valid range.

Static Methods

static LatLng fromRadians(lat:Number, lng:Number, opt_noCorrect:Boolean)

Creates a latlng from radian values.

Parameter Type Description
lat Number

Latitude in radians.

lng Number

Longitude in radians.

opt_noCorrect Boolean

Flag to prevent correction to valid range.

static LatLng fromUrlValue(value:String)

Parses a string of the form "lat,lng" and returns a point with those values.

// Create a LatLng from a text string.
var location:LatLng = LatLng.fromUrlValue("-34,151");
Parameter Type Description
value String

"lat,lng" string to parse.

Instance Methods

Number angleFrom(other:LatLng)

Returns the angle (radians) between this point and the given point. This is also the distance between those points on a unit sphere.

// Calculate angle in radians between London and Paris.
var london:LatLng = new LatLng(51.53, -0.08);
var paris:LatLng = new LatLng(48.8, 2.33);
trace("angle: " + paris.angleFrom(london));
Parameter Type Description
other LatLng

Other LatLng

LatLng clone()

Returns a new LatLng object that is a copy of this.

Number distanceFrom(other:LatLng, opt_radius:Number)

Returns the distance, in meters, from this point to the given point. Since we approximate the earth as a sphere, the distance could be off by as much as 0.3%.

// Calculate distance in km between London and Sydney.
var london:LatLng = new LatLng(51.53, -0.08);
var sydney:LatLng = new LatLng(-34.0, 151.0);
trace("km: " + sydney.distanceFrom(london) / 1000);
Parameter Type Description
other LatLng

Other LatLng

opt_radius Number

The radius of the planet (default EARTH_RADIUS).

Boolean equals(other:LatLng)

Tests whether this LatLng is coincident with another specified LatLng, allowing for numerical rounding errors.

Parameter Type Description
other LatLng

LatLng against which to compare.

Number lat()

Returns the latitude in degrees.

Number latRadians()

Returns the latitude in radians.

Number lng()

Returns the longitude in degrees.

Number lngRadians()

Returns the longitude in radians.

String toString()

Returns a string representation of this LatLng, for example '48.8584, 2.2944' for Paris.

String toUrlValue(opt_precision:Number)

Returns a string of the form "lat,lng" for this LatLng. We round the lat/lng values to 6 decimal places by default. <table> <tr><th>precision</th><th>approximate error</tr> <tr><td>-1</td><td>1000 kilometers / 700 miles</tr> <tr><td>0</td><td>100 kilometers / 70 miles</tr> <tr><td>1</td><td>10 kilometers / 7 miles</tr> <tr><td>2</td><td>1 kilometer / 0.7 miles</tr> <tr><td>3</td><td>100 meters / 300 feet</tr> <tr><td>4</td><td>10 meters / 30 feet</tr> <tr><td>5</td><td>1 meter / 3 feet</tr> <tr><td>6</td><td>10 centimeters / 4 inches</tr> <tr><td>7</td><td>1 centimeter (a nickel)</tr> </table>

Parameter Type Description
opt_precision Number

Number of digits following decimal point.

Back to top

class LatLngBounds

Constructors

LatLngBounds

Methods

clone, containsBounds, containsLatLng, equals, extend, getCenter, getEast, getNorth, getNorthEast, getNorthWest, getSouth, getSouthEast, getSouthWest, getWest, intersects, isEmpty, isFullLat, isFullLng, isLargerThan, toSpan, toString, union

A rectangular bounds on the Earth. The 2D interval is directed, i.e. it extends from the SW corner to the NE corner, even if the longitude interval from NE to SW (the other way round the earth) would be smaller. The bounds can be extended to contain new points with the extend() method.

Constructors

LatLngBounds(opt_sw:LatLng, opt_ne:LatLng)

Constructs a LatLngBounds from two LatLng instances, holding the SW extent and NE extent, respectively. A LatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees meridian.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(10, 50),   // spans 1 degree latitude
    new LatLng(11, 52));  // and 2 degrees longitude
Parameter Type Description
opt_sw LatLng

South-west corner (optional).

opt_ne LatLng

North-east corner (optional).

Instance Methods

LatLngBounds clone()

Creates a clone of this instance.

Boolean containsBounds(other:LatLngBounds)

Returns true if this bounds completely contains the given bounds.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(10, 50), new LatLng(20, 70));
trace(bounds.containsBounds(
    new LatLngBounds(
        new LatLng(11, 12), new LatLng(52, 68)));  // outputs true
Parameter Type Description
other LatLngBounds

Contained LatLngBounds.

Boolean containsLatLng(point:LatLng)

Returns true if the given lat/lng is in this bounds.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(10, 50),
    new LatLng(20, 70));
trace(bounds.containsLatLng(new LatLng(15, 51)));  // outputs true
trace(bounds.containsLatLng(new LatLng(29, 51)));  // outputs false
Parameter Type Description
point LatLng

Test point.

Boolean equals(other:LatLngBounds)

Returns true if this bounds equals the given bound, allowing for numerical rounding errors.

Parameter Type Description
other LatLngBounds

LatLngBounds against which to compare.

void extend(point:LatLng)

Extends this bounds to contain the given point.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(1, 5), new LatLng(2, 7));
bounds.extend(new LatLng(0, 9));
trace(bounds.toString());  // outputs "((0, 5), (2, 9))"
Parameter Type Description
point LatLng

Point to add.

LatLng getCenter()

Computes the center of this LatLngBounds

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(10, 50),
    new LatLng(20, 70));
trace(bounds.getCenter());  // outputs "(15, 60)"

Number getEast()

Returns the east longitude of this bounds.

Number getNorth()

Returns the north latitude of this bounds.

LatLng getNorthEast()

Returns the north-east corner of this bounds.

LatLng getNorthWest()

Returns the north-west corner of this bounds.

Number getSouth()

Returns the south latitude of this bounds.

LatLng getSouthEast()

Returns the south-east corner of this bounds.

LatLng getSouthWest()

Returns the south-west corner of this bounds.

Number getWest()

Returns the west longitude of this bounds.

Boolean intersects(other:LatLngBounds)

Returns true if this bounds shares any points with this bounds.

Parameter Type Description
other LatLngBounds

Test LatLngBounds.

Boolean isEmpty()

Returns true if the bounds are empty.

Boolean isFullLat()

Returns true if the bounds cover all latitudes.

Boolean isFullLng()

Returns true if the bounds cover all longitudes.

Boolean isLargerThan(other:LatLngBounds)

Returns true if this bounds is larger than (could contain) the other.

Parameter Type Description
other LatLngBounds

LatLng toSpan()

Converts the given map bounds to a lat/lng span.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(10, 50), new LatLng(20, 70));
trace(bounds.toSpan());  // outputs "(10, 20)"

String toString()

Converts this LatLngBounds to a string.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(1, 5),
    new LatLng(2, 7));
trace(bounds.toString());  // outputs "((1, 5), (2, 7))"

void union(other:LatLngBounds)

Extends this bounds to contain the union of this and the given bounds.

var bounds:LatLngBounds = new LatLngBounds(
    new LatLng(0, 0), new LatLng(1, 1));
bounds.union(
    new LatLngBounds(
        new LatLng(10, 20), new LatLng(15, 22)));
trace(bounds.toString());  // outputs "((0, 0), (15, 22))"
Parameter Type Description
other LatLngBounds

LatLngBounds to union with.

Back to top

class Map

Implements

IMap

Fields

MERCATOR_PROJECTION, key, language, overlayRaising, version

Constructors

Map

Methods

addControl, addMapType, addOverlay, callLater, clearControls, clearOverlays, closeInfoWindow, continuousZoomEnabled, controlByKeyboardEnabled, crosshairsEnabled, delayCall, disableContinuousZoom, disableControlByKeyboard, disableCrosshairs, disableDragging, disableScrollWheelZoom, draggingEnabled, enableContinuousZoom, enableControlByKeyboard, enableCrosshairs, enableDragging, enableScrollWheelZoom, fromLatLngToPoint, fromLatLngToViewport, fromPointToLatLng, fromViewportToLatLng, getBoundsZoomLevel, getCenter, getCurrentMapType, getDisplayObject, getDoubleClickMode, getImplementationVersion, getInterfaceVersion, getLatLngBounds, getMapTypes, getMaxZoomLevel, getMinZoomLevel, getPaneManager, getProjection, getSize, getZoom, isLoaded, openInfoWindow, panBy, panTo, removeControl, removeMapType, removeOverlay, returnToSavedPosition, savePosition, scrollWheelZoomEnabled, setCenter, setDoubleClickMode, setMapType, setSize, setZoom, zoomIn, zoomOut

This is the main class of the Maps API for Flash. Instantiate Map to create a map.

Properties

Name Type Description
MERCATOR_PROJECTION IProjection

Retrieves Mercator projection.

key String

The map key.

language String

The desired map language.

overlayRaising Boolean

Set to true to enable raising of overlays upon mouse-over. If enabled then a mouse-over event over an overlay that supports it (only markers do at present) will bring that overlay to the top. By default overlay raising is enabled.

version String

The desired map library version.

Constructors

Map()

Constructor. When this runs none of the bindable variables has yet been initialized. We defer actions that depend upon them until we have been added to the stage.

Instance Methods

void addControl(control:IControl)

Registers a new control. This can be called before the MAP_READY event has been received.

public class MyMap extends Map {
  public function MyMap() {
    super();
    addEventListener(MapEvent.MAP_READY, onMapReady);
    addControl(new MapTypeControl());
  }
}
Parameter Type Description
control IControl

New control to register.

void addMapType(newMapType:IMapType)

Registers a new map type.

Parameter Type Description
newMapType IMapType

New map type to register.

void addOverlay(overlay:IOverlay)

Adds an overlay to the map.

var marker:Marker = new Marker(
    new LatLng(48.858842, 2.346997),
    new MarkerOptions({ fillRGB: 0x004000,
                        name: "Paris, France",
                        description: "City on the Seine" }));
map.addOverlay(markerA);
Parameter Type Description
overlay IOverlay

The overlay to be added to the map.

void callLater(call:Function)

Parameter Type Description
call Function

void clearControls()

Removes all controls from the map.

void clearOverlays()

Removes all overlays from the map.

Boolean closeInfoWindow()

Closes the information window.

Boolean continuousZoomEnabled()

Checks whether continuous zoom is enabled.

Boolean controlByKeyboardEnabled()

Checks whether control by keyboard is enabled.

Boolean crosshairsEnabled()

Checks whether center crosshairs are enabled.

void delayCall(call:Function)

Delay a method call until the next frame.

Parameter Type Description
call Function

Method to invoke in the next frame.

void disableContinuousZoom()

Disables continuous smooth zooming.

void disableControlByKeyboard()

Disables control by keyboard.

void disableCrosshairs()

Disables the center crosshairs.

void disableDragging()

Disables dragging of the map.

void disableScrollWheelZoom()

Disables zooming using a mouse's scroll wheel.

Boolean draggingEnabled()

Checks whether dragging of the map is enabled.

void enableContinuousZoom()

Enables continuous smooth zooming.

void enableControlByKeyboard()

Enables control by keyboard.

void enableCrosshairs()

Enables the center crosshairs.

void enableDragging()

Enables dragging of the map.

void enableScrollWheelZoom()

Enables zooming using a mouse's scroll wheel.

Point fromLatLngToPoint(latLng:LatLng, opt_zoom:Number)

Returns x,y coordinates of specified lat, lng and zoom relative to the origin of the map's projection (the origin is the top left corner of the top left tile of the map for the specified map zoom level).

Parameter Type Description
latLng LatLng

latLng location on the map

opt_zoom Number

target zoom level (defaults to current zoom level)

Point fromLatLngToViewport(latLng:LatLng, opt_disablewrap:Boolean)

Returns the pixel coordinates for the specified latLng location in the coordinate system of the map's view port ([0,0] being the top left corner of the map object).

Parameter Type Description
latLng LatLng

LatLng coordinate of the point on the map.

opt_disablewrap Boolean

Whether wrapping of the map around +180/-180 degree longtitude is disabled.

Depending on the value of this parameter, the call may return the same or two different pixel coordinates depending on whether or not the shortest path between the current centre of the map and the target location crosses the +180/-180 degree longtitude wrap-around.

For example, the map is currently centred at Sydney, Australia [LatLng(-33.857, 151.215)] and the location passed into this call is San Francisco, USA [LatLng(37.779, -122.420)] This call will return two different pixel coordinates for the two values of the opt_disablewrap parameter.

By default (opt_disablewrap set to false), the map will wrap the around the +180/-180 degree longtitude to return the pixel coordinate that will lie to the right of the current centre of the map (picking the shorter path from Sydney to San Francisco that goes across the Pacific Ocean).

If the wrapping of the map is disabled (opt_disablewrap set to true), the pixel coordinate returned by the call will be to the left of the current centre (the longer path from Sydney to San Francisco going across the Indian and Atlantic Oceans).

The value returned by the call will be the same for either value of opt_disablewrap parameter if the shorter path from the current centre of the map to the target point does not cross the +180/-180 degree longtitude (such as in case where the current centre of the map is Sydney, Australia while the target location is Tokyo, Japan).

LatLng fromPointToLatLng(pos:Point, opt_zoom:Number, opt_nowrap:Boolean)

Returns lat,lng coordinates of specified x, y and zoom. The coordinates are relative to the origin of the map's projection (the top left corner of the top left tile of the map for the specified zoom level).

Parameter Type Description
pos Point

x, y of a point

opt_zoom Number

target zoom level (defaults to the current zoom level)

opt_nowrap Boolean

Do not wrap longitudes outside of [-180, 180)

LatLng fromViewportToLatLng(pos:Point, opt_nowrap:Boolean)

Returns the lat-lng of the point at the given coordinates in the map's view port (the top left corner of the map object).

Parameter Type Description
pos Point

Coordinates in the map's view port.

opt_nowrap Boolean

Do not wrap longitudes outside of [-180, 180)

Number getBoundsZoomLevel(bounds:LatLngBounds)

Returns the highest resolution zoom level at which the given rectangular region fits in the map view. The zoom level is computed for the currently selected map type.

Parameter Type Description
bounds LatLngBounds

Bounds to show.

LatLng getCenter()

Retrieves coordinates of the center in the map view control.

IMapType getCurrentMapType()

Retrieves the current map type.

DisplayObject getDisplayObject()

Retrieves the display object that represents the map.

Number getDoubleClickMode()

Get the mouse double click mode.

String getImplementationVersion()

Get the version of the implementation SWF.

String getInterfaceVersion()

Retrieves the version of the client interface.

LatLngBounds getLatLngBounds()

Returns the the visible rectangular region of the map view in geographical coordinates.

Array getMapTypes()

Retrieves the list of the map types available for the location.

Number getMaxZoomLevel(opt_mapType:IMapType, opt_point:LatLng)

Retrieves the maximum zoom level.

Par