
This reference manual defines the classes and methods for all Flash APIs, including the JavaScript™-Flash API, ActionScript®-Flash API and Flex™ API. Unless otherwise noted, all classes and methods are available for both JavaScript and ActionScript.
Need more help? Check out our Getting Started Guides for the JS-Flash API, the AS-Flash API and the Flex API.
| Class | Description |
|---|---|
| EdgePan | The EdgePan tool allows the user to pan the map with only mouse movement, the map pans when the cursor is along the edges of the map. |
| CustomImageMarker | Lets you add a marker with a custom image to the map surface at a specific position. |
| CustomPOIMarker | An expandable marker that expands when the user clicks on the marker. |
| CustomSWFMarker | Lets you load your own custom SWF marker. |
| CustomSWFOverlay | Loads your own custom SWF overlay routines. |
| CustomSWFTool | Loads your own custom SWF tool that can be used to manipulate the map. |
| CustomSWFWidget | Loads your own custom SWF widget that can be used for a custom map interface. |
| Distance | A class that calculates the distance between two LatLon objects |
| EventManager | [JavaScript Only] Classes that extend EventManager have the ability to dispatch custom events specified by an event type string. |
| GeoRSSOverlay | Loads and plots a GeoRSS feed on the map. |
| Languages | Holds static references to the valid supported map languages. |
| LatLon | An X-Y representation of a specific point on the map using latitude and longitude. |
| LatLonRect | A representation of a distinct rectangle of space on a map using latitude and longitude. |
| LocalSearchFilter | Each time a successful search is performed when using LocalSearchOverlay, 0 to n filters are returned. |
| LocalSearchOverlay | Plots the results of text searches on the map using a large database of business descriptions, ratings, and locations. |
| LocalSearchResults | An object representing a successful search performed using the LocalSearchOverlay |
| Map | Instantiate a map object |
| Marker | Instantiate a marker object |
| MapViews | Holds static references to the three valid Map View Types |
| NavigatorWidget | Adds a specialized navigation tool to the map. |
| Overlay | Creates a distinct surface on top of the map that moves along with the map as it pans. |
| PanTool | The PanTool allows the user to drag the map around for panning. |
| Point | Lets you create a Point object which can be passed to the Map.setCenterByPointDelta() method. |
| PolylineOverlay | An object that allows you to plot lines, curves and shapes over the map. |
| SatelliteControlWidget | Allows the user to switch between different mapViewTypes. |
| SuggestedAddress | Returned when a geocode error occurs. Suggested addresses can help narrow down possible values for the address that was originally entered. |
| Tool | The parent class of various tools (such as the PanTool) that let users interact with the map. |
| ToolBarWidget | A widget that shows all the tools that have been added to the map by using Map.addTool(). |
| TrafficOverlay | Shows the auto traffic incidents reported for the currently viewable map area. |
| WaypointMarker | A small black marker that displays a single index. |
| Widget | A widget represents a distinct object on the top layer of the map that usually displays information or allows users to interact with the map. |
The EdgePan tool allows the user to pan the map using the movement of the mouse. When the mouse is along the edges of the map, the map will pan in that direction. It also allows the user to double click on a position on the map and pan to that location when not along the edge.
| Class | Inherited Methods |
|---|---|
| Tool | isInitialized |
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
Usage Example:
import com.yahoo.maps.tools.EdgePan;
var edgePan = new EdgePan();
function addTool():Void {
myMap.addTool(edgePan, true);
}
Lets you to add a custom image to the map surface at a specific position. Currently, images may only be SWF files or non-progressive JPEGs.
| Parameter | Description |
|---|---|
| url | The url (string) parameter specifies the URL of the image file to use for the custom marker. |
| Method | Description |
|---|---|
| getURL() | Returns a string that is the URL of the customized marker image. This is the URL that was specified by the constructor. Return value: string |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Marker | hide, isInitialized, isVisible, show |
import com.yahoo.maps.markers.CustomImageMarker;
function addNewMarker():Void {
myMap.addMarkerByAddress(CustomImageMarker, "701 1st Ave, Sunnyvale, CA", {url:"image.jpg"} );
}
An expandable marker that expands when the user clicks on the marker. When the mouse is not over the marker, only the index is shown. When rolled over, the index and title are shown. Once clicked on, the marker shows the index, title, and description.
| Parameter | Description |
|---|---|
| index | The index (string) is the marker's index, or label. It is usually a single character string such as "A" or "B". |
| title | The title parameter (string) that is a title that appears when you roll the mouse cursor over the marker. |
| description | The description (string) describes the marker when you click it. This parameter supports Flash textfield HTML formatting (a sub. |
| markerColor | The markerColor is a hexadecimal number that specifies the marker's body color when the mouse is not over the marker. It also specifies the stroke when the marker expands to display the title or the description. |
| strokeColor | The strokeColor (string) specifies the hexadecimal number that represents the marker's stroke color (or outline color) when the mouse is over the marker. It becomes the body color when you roll the mouse over the marker to display the title or click the marker to display the description. |
| Method | Description |
|---|---|
| close() | Closes a marker that is expanded. Return value: void |
| open() | Opens or expands the marker to the state it would be in if the user rolled over it. Return value: void |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllListeners, removeEventListener |
| Marker | hide, isInitialized, isVisible, show |
| Property | Description |
|---|---|
| strokeColor | Specifies the hexadecimal number that represents the marker's stroke (or outline) color. |
import com.yahoo.maps.markers.CustomPOIMarker;
var myMarker = {index:"Yahoo!", title:"HQ", description:"701 1st Ave, Sunnyvale, CA", markerColor:0x990099, strokeColor:0xFFFF00}};
function addNewMarker():Void {
myMap.addMarkerByAddress(CustomPOIMarker, "701 1st Ave, Sunnyvale, CA", myMarker);
}
The CustomSWFMarker class allows you to load a marker SWF that conforms to a specific interface. By implementing specific methods in the SWF, you can interact on a much richer level with the marker.
| Parameter | Description |
|---|---|
| url | A string. The url specifies the URL of the SWF file, or the linkage id of the movie clip in the SWFs library containing the custom marker. |
| ref | A number. The reference you can pass that will be returned when the marker is created. This allows you to identify each custom SWF marker you have added. |
| useClip (ActionScript only) | A boolean. Specifies whether to load a clip from your SWFs library (true), or to use a external swf url (false) |
| Method | Description |
|---|---|
| callCustomMethod (methodNames, methodArgs ) |
Call a custom method on the SWF. If the user has implemented a custom method outside the specific interface, you can access that method by calling this. Parameters:
Return value: void |
| getURL() | Returns the URL of the swf as a string Return value: string |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Marker | hide, isInitialized, isVisible, show |
import com.yahoo.maps.markers.CustomSWFMarker;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_CUSTOM_MARKER_LOADED, onMarkerLoad);
var marker;
var markerRef;
function addNewMarker():Void {
myMap.addMarkerByAddress(CustomSWFMarker, "701 1st Ave, Sunnyvale, CA", {url:"marker.swf", ref:1, useClip:false} ); //loads a external swf file.
myMap.addMarkerByLatLon(CustomSWFMarker, new LatLon(37.389554,-121.977971), {url:myMarker, ref:2, useClip:true} ); //loads a movie clip from the library using a linkage id.
}
function onMarkerLoad(event):Void {
marker = event.marker;
markerRef = event.ref;
}
Similar to CustomSWFMarker, a custom overlay SWF component can be loaded by creating a new CustomSWFOverlay.
| Parameter | Description |
|---|---|
| url | A string. The url specifies the URL of the SWF file, or the linkage id of the movie clip in the SWFs library containing the custom overlay. |
| useClip (ActionScript only) | A boolean. Specifies whether to load a clip from your SWFs library (true), or to use a external swf url (false). |
| Method | Description |
|---|---|
| callCustomMethod (methodNames, methodArgs ) |
Call a custom method on the SWF. If the user has implemented a custom method outside the specific interface, you can access that method by calling this. Parameters:
Return value: void |
| isLoaded() | Checks whether a custom SWF overlay has finished loading. Return value: A Boolean value stating whether an overlay has finished loading (true) or not (false). |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListeners |
| Marker | hide, isInitialized, isVisible, show |
import com.yahoo.maps.overlays.CustomSWFOverlay;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_CUSTOM_OVERLAY_LOADED, onOverlayLoad);
var myOverlay = new CustomSWFOverlay("URL_TO_OVERLAY.swf");
function addNewOverlay():Void {
myMap.addOverlay(myOverlay);
}
function onOverlayLoad(event):Void {
var overlay = event.overlay;
}
A CustomSWFTool represents a SWF file that contains the proper methods for creating custom interactions with the map.
| Parameter | Description |
|---|---|
| url | A string. The url specifies the URL of the SWF files, or the linkage IDs of the movie clip in the SWFs library that contains the tool methods. |
| iconUrl | The iconUrl (string) specifies the URL of the image file or SWF file containing the icon that will appear in the toolbar widget. |
| useClip (ActionScript only) | A boolean. Specifies whether to load a clip from your SWFs library (true), or to use a external swf url (false). |
| Method | Description |
|---|---|
| isLoaded() | Checks whether a custom SWF tool has finished loading. Return value: A Boolean value stating whether a tool has finished loading (true) or not (false). |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListeners |
| Tool | isInitialized |
| Property | Description |
|---|---|
| EVENT_LOADED | Static property that contains the name of the loaded event |
import com.yahoo.maps.tools.CustomSWFTool;
myMap.addEventListener(com.yahoo.maps.tools.CustomSWFTool.EVENT_LOADED, onToolLoad);
var myTool = new CustomSWFTool("URL_TO_OVERLAY.swf", "URL_TO_ICON.swf");
function addNewTool():Void {
myMap.addTool(myTool);
}
function onToolLoad(event):Void {
var tool = event.tool;
}
Similar to CustomSWFMarker, a custom widget can be loaded by creating a new CustomSWFWidget.
| Parameter | Description |
|---|---|
| url | A string. The url specifies the URL of the SWF file, or the linkage id of the movie clip in the SWFs library containing the custom widget. |
| position (ActionScript only) | An object containing x and y properties which set the position of the widget. |
| useClip (ActionScript only) | A boolean. Specifies whether to load a clip from your SWFs library (true), or to use a external swf url (false). |
| Method | Description |
|---|---|
| callCustomMethod (methodNames, methodArgs ) |
Call a custom method on the SWF. If the user has implemented a custom method outside the specific interface, you can access that method by calling this. Parameters:
Return value: void |
| isLoaded() | Checks whether a custom SWF widget has finished loading. Return value: A Boolean value stating whether an overlay has finished loading (true) or not (false). |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListeners |
| Marker | hide, isInitialized, isVisible, show |
import com.yahoo.maps.widgets.CustomSWFWidget;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_CUSTOM_WIDGET_LOADED, onWidgetLoad);
var myWidget = new CustomSWFWidget("URL_TO_WIDGET.swf");
function addNewOverlay():Void {
myMap.addWidget(myWidget);
}
function onWidgetLoad(event):Void {
var widget = event.widget;
}
A class that calculates the distance between two LatLon objects.
| Method | Description |
|---|---|
| getDistance(point_one, point_two) | Get the distance between two LatLon objects. Returns an object containing the distance values for kilometers (km), miles (mi) and nautical miles (nmi). Parameters:
Return value: Object |
import com.yahoo.maps.utils.Distance;
import com.yahoo.maps.markers.CustomPOIMarker;
import com.yahoo.maps.LatLon;
map.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, onMapInit);
var dist = new Distance();
function onMapInit() {
var markerOne = map.addMarkerByLatLon(CustomPOIMarker, new LatLon(47.605, -122.33), {index:"Seattle"});
var markerTwo = map.addMarkerByLatLon(CustomPOIMarker, new LatLon(37.774,-122.417), {index:"San Francisco"});
var marker_dist = dist.getDistance(markerOne.latlon, markerTwo.latlon);
trace(marker_dist.mi); //trace the distance in miles.
trace(marker_dis.km); //trace the distance in kilometers.
}
Lets you listen for specified events.
| Method | Description |
|---|---|
| addEventListener (eventType, functionName, scope ) |
Listen for an event of eventType and call the specified function in the specified scope. Parameters:
Return value: void |
| JavaScript only: removeAllEventListeners() |
Remove all event listeners for this object that have been subscribed by using addEventListener(). Return value: void |
| removeEventListener (eventType, functionName, scope ) |
Removes the specified event listener for this object that have been subscribed by using addEventListener(). Parameters:
Return value: void |
The GeoRSSOverlay class allows you to load a document and plot a feed of GeoRSS items on the map.
| Parameter | Description |
|---|---|
| url | The url (string) specifies the URL of the RSS feed to load. The url provided must be absolute, not relative. To avoid the need for a crossdomain policy file on the server hosting the rss feed, the request is proxied through a Yahoo! server, therefore the feed must be publicly accessible. |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListeners |
| Overlay | hide, isInitialized, isVisible, show |
import com.yahoo.maps.overlays.GeoRSSOverlay;
var rssOverlay = new GeoRSSOverlay("http://developer.yahoo.com/maps/sample.xml");
function addNewOverlay():Void {
myMap.addOverlay(rssOverlay);
}
Holds static references to the supported, valid map languages
| Property | Description |
|---|---|
| en_US | Static property that contains the name of the "en_US" (English) map language type. |
| es_ES | Static property that contains the name of the "es_ES" (Espanol) map language type. |
| it_IT | Static property that contains the name of the "it_IT" (Italiano) map language type. |
| de_DE | Static property that contains the name of the "de_DE" (Deutsch) map language type. |
| fr_CA | Static property that contains the name of the "fr_CA" (French-Canadian) map language type. |
| fr_FR | Static property that contains the name of the "fr_FR" (French) map language type. |
| all | Static property that contains an array of all the map language types. |
import com.yahoo.maps.api.Languages;
function setMapLocale(type:String):Void {
myMap.setLocale(type);
}
setMapLocale(Languages.it_IT);
Represents a point on the map through the intersection of latitude and longitude coordinates.
| Parameter | Description |
|---|---|
| latitude | The latitude (float) that represents a measure of latitude, or location north or south of the equator. |
| longitude | The longitude (float) that represents a measure of longitude, or location east or west of the prime meridian. |
| Parameter | Description |
|---|---|
| lat | A floating-point number that represents a measure of latitude, or location north or south of the equator. |
| lon | A floating-point number that represents a measure of longitude, or location east or west of the prime meridian. |
| latRadians | A floating-point number between -PI/2 and +PI/2 that represents a measure of latitude in radians. |
| lonRadians | A floating-point number between -PI and +PI that represents a measure of longitude in radians. |
| Method | Description |
|---|---|
| isIdentical(latlon:LatLon) | Returns true if other latlon object has equal location properties. |
| toString() | Returns a string with comma separated values that represents the point by latitude and longitude respectively. |
| getDistanceFrom(latlon:LatLon) | Returns an object containing the distance values for kilometers (km), miles (mi) and nautical miles (nmi). |
import com.yahoo.maps.LatLon;
var latlon:LatLon = new LatLon(37.389554,-121.977971);
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INTIALIZE, onMapInit);
function setLocation():Void {
myMap.setCenterByLatLon(latlon);
}
function onMapInit(event:Object):Void {
var center:LatLon = event.center;
}
A distinct rectangle of space on a map defined by two sets of latitude and longitude coordinates.
| Parameter | Description |
|---|---|
| minLat | A floating-point number that represents the measure of latitude on the map for the rectangle's starting point, or upper left-hand corner |
| minLon | A floating-point number that represents the measure of longitude on the map for the rectangle's starting point, or upper left-hand corner. |
| maxLat | A floating-point number that represents the measure of latitude on the map for the rectangle's ending point, or lower right-hand corner. |
| maxLon | A floating-point number that represents the measure of longitude on the map for the rectangle's ending point, or lower right-hand corner. |
| Property | Description |
|---|---|
| minLat | A floating-point number that represents the measure of latitude on the map for the rectangle’s starting point, or upper left-hand corner. |
| minLon | A floating-point number that represents the measure of longitude on the map for the rectangle’s starting point, or upper left-hand corner. |
| maxLat | A floating-point number that represents the measure of latitude on the map for the rectangle’s ending point, or lower right-hand corner. |
| maxLon | A floating-point number that represents the measure of longitude on the map for the rectangle’s ending point, or lower right-hand corner. |
| northeast | A LatLon object that represents the geographical location of the northeast (top-right) corner of the bounds. |
| northwest | A LatLon object that represents the geographical location of the northwest (top-left) corner of the bounds. |
| southeast | A LatLon object that represents the geographical location of the southeast (bottom-right) corner of the bounds. |
| southwest | A LatLon object that represents the geographical location of the southwest (bottom-left) corner of the bounds. |
import com.yahoo.maps.LatLon;
import com.yahoo.maps.LatLonRect;
var mapBounds:LatLonRect;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INTIALIZE, onMapInit);
function onMapInit(event:Object):Void {
mapBounds = event.bounds;
}
Each time a successful search is performed when using the LocalSearchOverlay class, 0 to n filters are returned. Each filter represents a possible refinement of the search results. By using the key attribute of the filter, the same search terms will return refined results as described by the name attribute.
| Property | Description |
|---|---|
| count | The number of results, out of the total search results returned, that comply with this filter. |
| key | A string that specifies the key that needs to be passed back to LocalSearchOverlay.search() method to retrieve the refined results. |
| name | A string that provides a readable description of the filter. |
| type | A string that specifies the filter type, of which there are two, represented by LocalSearchFilter.TYPE_RATING and LocalSearchFilter.TYPE_CATEGORY. Rating filters allow the user to refine the search by the rating of the search results usually from one to five stars. Category filters filter by a specific category of results. For example, a search for food might return category filters with names such as "grocery", "fast food", "cafes", etc. |
| TYPE_CATEGORY | Possible value for the LocalSearchFilter.type property. If the type property is equal to the LocalSearchFilter.TYPE_CATEGORY constant, the search() method of the LocalSearchOverlay class can use the key attribute as its categoryFilter parameter. |
| TYPE_RATING | Possible value for the LocalSearchFilter.type property. If the type property is equal to the LocalSearchFilter.TYPE_RATING constant, the search() method of the LocalSearchOverlay class can use the key attribute as its ratingFilter parameter. |
The LocalSearchOverlay class allows developers to access the large database of business descriptions, ratings, and locations from Yahoo! Local and plot them on their map.
| Method | Description |
|---|---|
| clear() | Clear the currently active search Return value: void |
| search ( searchTerms, latlon, startIndex, results, radius, categoryFilter, ratingFilter, source, apiKey, returnAsLocalSearch ) |
Search for businesses using the specified criteria. Parameters:
Return value: void |
| addLocalSearchWidget() | New! Adds a local search widget with ready access to each Yahoo! API to the map. Return value: void |
| removeLocalSearchWidget() | Removes the local search widget from the map. Return value: void |
| setMutipleSearches(boolean) | Allows calls to search multiple times without markers being removed after each successful search. Return value: boolean |
| Property | Description |
|---|---|
| EVENT_SEARCH_ERROR | Static property that contains the name of the searchError event |
| EVENT_SEARCH_SUCCESS | Static property that contains the name of the searchSuccess event |
| EVENT_API_SEARCH_SUCCESS | Static property that contains the name of the apiSearchSuccess event |
| EVENT_WIDGET_ADDED | Static property that contains the name of the widgetAdded event |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Overlay | hide, isInitialized, isVisible, show |
| Event | Description |
|---|---|
| searchError | This event dispatches when the search() method encounters an error. The event contains two properties.
|
| searchSuccess | This event dispatches when the search() method completes successfully. The event object contains two properties.
|
| apiSearchSuccess | This event dispatches when the search() method completes successfully using a Yahoo! API and returnAsLocalSearch is false. The event contains two properties.
|
| widgetAdded | This event dispatches when the local search widget is successfully added to the map. The event object contains a single property.
|
import com.yahoo.maps.overlays.LocalSearchOverlay;
var localSearch = new LocalSearchOverlay();
localSearch.addEventListener( com.yahoo.maps.overlays.LocalSearchOverlay.EVENT_SEARCH_SUCCESS, onLocalStatus);
localSearch.addEventListener( com.yahoo.maps.overlays.LocalSearchOverlay.EVENT_SEARCH_ERROR, onLocalStatus);
function addNewOverlay():Void {
myMap.addOverlay(localSearch);
localSearch.search('mexican food', myMap.getCenter() );
}
function onLocalStatus(event):Void {
if (event.type == "searchError") {
...
}
else if (event.type == "searchSuccess") {
...
}
}
function addLocalWidget():Void {
localSearch.addLocalSearchWidget();
}
function removeLocalWidget():Void {
localSearch.removeLocalSearchWidget();
}
An object representing a successful search performed using the LocalSearchOverlay
| Property | Description |
|---|---|
| resultsCount | The number of results returned by this search. |
| searchFilters | An array of LocalSearchFilter objects that represent possible filters that could be applied to this search. |
| totalResultsCount | The total number of possible results that could be returned applying the current search criteria. |
An object that defines a map.
| Parameter | Description |
|---|---|
| container | The ID of the map in the HTML page, Flash document, or Flex document. For HTML, this is the usually the CSS "id" name of the tag containing the map. |
| appid | Your Yahoo! application ID. If you don't have one, get one here. |
| location | A LatLon object or string (address) that specifies the map’s initial position. If the string cannot be geocoded to a LatLon object, an EVENT_MAP_GEOCODE_ERROR event will be dispatched. |
| zoom | The zoom level of the map -- a number between 1 and 17. The default zoom level is 14. |
| mapViewType | The Map View Type of the map. Valid values are MapViews.SATELLITE, MapViews.HYBRID, and MapViews.MAP. |
| language | The language/locale of the map. Valid values are Languages.en_US, Languages.es_ES, Languages.it_IT, Languages.de_DE, Languages.fr_CA, Languages.fr_FR. |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Property | Description |
|---|---|
| EVENT_CUSTOM_MARKER_LOADED | Static property that contains the name of the customMarkerLoaded event. |
| EVENT_CUSTOM_OVERLAY_LOADED | Static property that contains the name of the customOverlayLoaded event. |
| EVENT_CUSTOM_WIDGET_LOADED | Static property that contains the name of the customWidgetLoaded event. |
| EVENT_INITIALIZE | Static property that contains the name of the initialize event. |
| EVENT_MAP_GEOCODE_ERROR | Static property that contains the name of the mapGeocodeError event. |
| EVENT_MAP_GEOCODE_SUCCESS | Static property that contains the name of the mapGeocodeSuccess event. |
| EVENT_MAPTILES_LOADED | Static property that contains the name of the mapTilesLoaded event. |
| EVENT_MAP_TYPE_CHANGED | Static property that contains the name of the mapTypeChanged event. |
| EVENT_MARKER_GEOCODE_ERROR | Static property that contains the name of the markerGeocodeError event. |
| EVENT_MARKER_GEOCODE_SUCCESS | Static property that contains the name of the markerGeocodeSuccess event. |
| EVENT_MARKER_DRAG_START | Static property that contains the name of the markerDragStart event. |
| EVENT_MARKER_DRAG_STOP | Static property that contains the name of the markerDragStop event. |
| EVENT_MARKER_DRAG | Static property that contains the name of the markerDrag event. |
| EVENT_MOVE | Static property that contains the name of the move event. |
| EVENT_NAVIGATOR_STATE_CHANGED | Static property that contains the name of the navigatorStateChanged event. |
| EVENT_ONCLICK | Static property that contains the name of the onClick event. |
| EVENT_PAN_START | Static property that contains the name of the panStart event. |
| EVENT_PAN_STOP | Static property that contains the name of the panStop event. |
| EVENT_POI_CLICKED | Static property that contains the name of the poiMarkerClicked event. |
| EVENT_SET_BOUNDS_COMPLETE | Static property that contains the name of the setBoundsComplete event. |
| EVENT_TOOL_ADDED | Static property that contains the name of the toolAdded event. |
| EVENT_TOOL_CHANGE | Static property that contains the name of the toolChange event. |
| EVENT_TOOL_REMOVED | Static property that contains the name of the toolRemoved event. |
| EVENT_WAYPOINT_MARKER_ADDED | Static property that contains the name of the waypointMarkerAdded event |
| EVENT_ZOOM | Static property that contains the name of the zoom event. |
| EVENT_ZOOM_STOP | Static property that contains the name of the zoomStop event. (Deprecated alias is property EVENT_ZOOM_END and zoomEnd event) |
| EVENT_ZOOM_START | Static property that contains the name of the zoomStart event |
| mapConfig | An object with specific properties that override the maps existing labels. The expected properties in the object are mapLabel, hybridLabel, satelliteLabel, countryLabel, stateLabel, cityLabel, streetLabel, rateItLabel and moreInfoLabel. |
| maxZoom | A number that contains the maximum zoom level of the map. |
| minZoom | A number that contains the minimum zoom level of the map. |
| lat | A gettable/settable number that contains the current latitude of the map. |
| lon | A gettable/settable number that contains the current longitude of the map. |
| Event | Description |
|---|---|
| customMarkerLoaded | This event dispatches when the custom SWF marker has been successfully placed and is loaded using the addMarkerByAddress() or addMarkerByLatLon() methods. The event object contains two properties:
|
| customOverlayLoaded | This event dispatches when the custom SWF overlay has been successfully placed and loaded using the addOverlay method. The event contains a single property.
|
| customWidgetLoaded | This event dispatches when the custom SWF widget has been successfully placed and loaded using the addWidget method. The event contains a single property.
|
| initialize | This event dispatches after the Flash SWF file that contains the map engine has loaded and is ready for interaction. The event object contains three properties:
|
| mapGeocodeSuccess | This event dispatches when the map successfully geocodes an address when you call the setCenterByAddress() and setCenterByAddressAndZoom() method. The event object contains two properties:
|
| mapGeocodeError | This event dispatches when a geocoding error occurs when you call the setCenterByAddress() method. The event object contains two properties:
|
| markerGeocodeError | This event dispatches when there has been a geocoding error when calling the addMarkerByAddress() method. The event object contains three properties:
|
| markerGeocodeSuccess | This event dispatches when the marker has been successfully placed using the addMarkerByAddress() method. The event object contains three properties:
|
| markerDragStart | This event dispatches when the marker 'draggable' property is true and has been clicked on to begin dragging. The event object contains two properties:
|
| markerDragStop | This event dispatches when the marker 'draggable' property is true and has been released to end dragging. The event object contains four properties:
|
| markerDrag | This event dispatches when the marker 'draggable' property is true and is currently being dragged over the map. The event object contains four properties:
|
| mapTilesLoaded | This event dispatches when all map tiles have been loaded. The event object contains two properties:
|
| mapTypeChanged | This event dispatches when the map view type (Map, Satellite, Hybrid) has been changed. The event object contains a single property:
|
| move | This event dispatches whenever the map changes its latitude or longitude. The event object contains two properties:
|
| navigatorStateChanged | This event dispatches when the NavigatorWidget is opened or closed. |
| onClick | This event dispatches when the map is clicked or double-clicked. The event object contains three properties:
Note: This event is dispatched from tools PanTool and EdgePan, so one of these tools must be added to the map. |
| panStart | This event dispatches whenever the map starts to pan. Panning is initiated whenever the duration is set to be greater than 0 in the Map.setCenterByAddress(), Map.setCenterByLatLon(), or Map.setCenterByPointDelta() methods. |
| panStop | This event dispatches when panning has stopped. |
| poiMarkerClicked | This event dispatches when a POI marker that has been added to the map is clicked. This event contains two properties:
|
| setBoundsComplete | This event dispatches when the map successfully sets new bounds. |
| toolAdded | This event dispatches when new tool has been added to the map. The event object contains a single property:
|
| toolChange | This event dispatches when the currently active tool has changed. The event object contains a single property:
|
| toolRemoved | This event dispatches when a tool has been removed from the map. The event object contains a single property:
|
| waypointMarkerAdded | This event dispatches during when a new waypoint marker is added. The event object contains two properties:
|
| zoom | This event dispatches during when the map zooms. This event is thrown multiple times when the map zooms. The event object contains three properties:
|
| zoomEnd | This event dispatches when the map has zoomed to the target zoom level. The event object contains two properties:
|
| zoomStart | This event dispatches when zooming starts. The event object contains two properties:
|
Holds static references to the three valid Map View Types
| Property | Description |
|---|---|
| SATELLITE | Static property that contains the name of the "satellite" map view type. |
| HYBRID | Static property that contains the name of the "hybrid" map view type. |
| MAP | Static property that contains the name of the "map" map view type. |
import com.yahoo.maps.MapViews;
function setType():Void {
myMap.setMapViewType(MapViews.HYBRID); //or MapViews.SATELLITE or MapViews.MAP.
}
The Marker class allows you to define map markers and toggle the visibility of markers on a map. There are several types of markers supported including: image markers ( CustomImageMarker class ), point of interest markers ( CustomPOIMarker class), SWF markers ( CustomSWFMarker class), and waypoint markers ( WaypointMarker class ).
| Method | Description |
|---|---|
| hide() | Hides this marker on a map. Return value: void |
| isInitialized() | Returns boolean value that determines whether the object has been created. Return value: boolean |
| isVisible() | Returns boolean value that indicates whether the marker is currently visible. Return value: boolean |
| show() | Makes the marker visible on the map. Return value: void |
| moveToLatLon(latlon) | Moves the marker to a new location on the map. Return value: void |
| setDraggable(boolean) | Sets the markers draggable property Return value: void |
| getDraggable() | Gets the markers draggable property Return value: Boolean |
| JavaScript Only: getMarkerByJavaScriptId(javaScriptId) |
Returns the marker with the specified objects javaScriptId Return value: Marker |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Property | Description |
|---|---|
| EVENT_INITIALIZE | Static property that contains the name of the initialize event. |
| latlon | A LatLon object containing the geographical location of the marker on the map. This property is gettable & settable. |
| draggable | A boolean. When set to true the marker will become draggable, allowing a user to drag and drop a marker onto a new point on the map. |
| Event | Description |
|---|---|
| initialize | This event dispatches when the representative Marker object has been created. |
The NavigatorWidget class lets users zoom and pan the map based on a small mini-map that appears on the map surface. NavigatorWidget instances can be added to the map using Map.addWidget()
| Method | Description |
|---|---|
| close():Void | Close the navigator widget so that only the zoom-bar appears. Return value: void |
| open():Void | Open the navigator widget so that the mini-map appears. Return value: void |
| move(x:Number, y:Number):Void | Positions the widget at the specified x and y coordinates. Return value: void |
| Class | Inherited Methods |
|---|---|
| Widget | hide , isInitialized , isVisible , show |
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
import com.yahoo.maps.widgets.NavigatorWidget;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_NAVIGATOR_STATE_CHANGED, onNavOpenClose)
var navigatorWidget = new NavigatorWidget("open");
function addNavWidget():Void {
myMap.addWidget(navigatorWidget);
}
function onNavOpenClose(event:Object):Void {
...
}
The Overlay class represents a distinct surface on top of the map that moves along with the map as it pans. An overlay is like a transparent layer that can contain information, such as local businesses or traffic conditions.
| Method | Description |
|---|---|
ActionScript only: |
Adds a Marker object at the requested address. Parameters:
Return value: a string representing the hash of the current marker.
|
ActionScript only: |
Adds a Marker object at the requested latitude/longitude. Parameters:
Return value: a string
|
| hide() | Makes the overlay invisible. Return value: void |
| isInitialized() | Returns boolean value that determines whether the overlay has been created. Return value: boolean |
| isVisible() | Returns boolean value that indicates whether the overlay is currently visible. Return value: boolean |
| ActionScript only: removeAllMarkers() |
Removes all markers. Return value: void |
ActionScript only: |
Removes the Marker object. Parameters:
Return value: void |
| show() | Makes the overlay visible on the map. Return value: void |
| JavaScript Only: getOverlayByJavaScriptId(javaScriptId) |
Returns the overlay with the specified objects javaScriptId Return value: Overlay |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Property | Description |
|---|---|
| EVENT_INITIALIZE | A static property with the value "initialize". |
| Event | Description |
|---|---|
| initialize | The event dispatches when the representative Overlay object has been created. |
The PanTool allows the user to drag the map around for panning. It also allows the user to double click on a position on the map and pan to that location.
| Class | Inherited Methods |
|---|---|
| Tool | isInitialized |
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Property | Description |
|---|---|
| EVENT_DRAG_STOP | A static property with the value dragStop |
| EVENT_DRAG_START | A static property containing the name of the dragStart event. |
| Event | Description |
|---|---|
| dragStart | This event dispatches when the pan tool starts dragging the map. |
| dragStop | This event dispatches when the pan tool stops dragging the map. |
import com.yahoo.maps.tools.PanTool;
var panTool = new PanTool();
panTool.addEventListener(com.yahoo.maps.tools.PanTool.EVENT_DRAG_STOP, onPanStatus);
panTool.addEventListener(com.yahoo.maps.tools.PanTool.EVENT_DRAG_START, onPanStatus);
function addNewTool():Void {
myMap.addTool(panTool, true);
}
function onPanStatus(event):Void {
if (event.type == "dragStart") {
...
}else if (event.type == "dragStop") {
...
}
}
Lets you create a Point object which can be passed to the Map.setCenterByPointDelta() method.
| Parameter | Description |
|---|---|
| x | The number of pixels to move the map horizontally. Passing a negative number for x causes the map to pan to the right. |
| y | The number of pixels to move the map vertically. Passing a negative number for y causes the map to pan down. |
| Property | Description |
|---|---|
| x | The number of pixels to move the map horizontally. |
| y | The number of pixels to move the map vertically. |
import flash.geom.Point;
var myPoint:Point = new Point(-100,100); // 100 pixels right, 100 pixels up.
function setMapToPoint():Void {
myMap.setCenterByPointDelta(myPoint);
}
The PolylineOverlay class allows developers to plot points, draw lines and fill shapes on the map to create a new layer of visual location information.
| Parameters | Description |
|---|---|
| url | The url (string) specifies the URL of the XML file containing the LatLon points. [JavaScript only] - An absolute URL to the .swf file must be used. |
| Parameters | Description |
|---|---|
| clear() | Clears the specified overlay Return value: void |
| Property | Description |
|---|---|
| EVENT_POLYLINE_ERROR | Static property that contains the name of the overlayPolylineError event. |
| EVENT_POLYLINE_SUCCESS | Static property that contains the name of the overlayPolylineSuccess event. |
| url | A string which contains the url of the the polyline xml file. When changed, the overlay will redraw. |
| dataProvider | An object which contains the data from the XML file. When changed, the overlay will redraw. |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Overlay | hide, isInitialized, isVisible, show |
| Event | Description |
|---|---|
| polylineError | This event dispatches when the overlay cannot validate the feed or successfully plot points. |
| polylineSuccess | This event dispatches when the overlay validates and draws successfully. |
import com.yahoo.maps.overlays.PolylineOverlay;
var polyline = new PolylineOverlay("http://developer.yahoo.com/maps/flash/V3.04/asGS.06.xml");
polyline.addEventListener(com.yahoo.maps.overlays.PolylineOverlay.EVENT_POLYLINE_SUCCESS, onSuccess);
function addPolylines():Void {
myMap.addOverlay(polyline);
}
function onSuccess(event):Void {
trace("poly success")
}
function updatePoly():Void {
poly.url = "http://developer.yahoo.com/maps/flash/V3.04/asGS.07.xml";
}
The SatelliteControlWidget class allows an end user to switch between different mapViewTypes. SatelliteControlWidget instances can be added to the map using Map.addWidget()
| Method | Description |
|---|---|
| move(x:Number, y:Number):Void | Positions the widget at the specified x and y coordinates. Return value: void |
| redraw(orientation:String):Void | Redraws the widget with the specified arrangement, horizontal or vertical. Return value: void |
| Class | Inherited Methods |
|---|---|
| Widget | hide , isInitialized , isVisible , show |
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Property | Description |
|---|---|
| VERTICAL | A static property with the value "vertical". |
| HORIZONTAL | A static property with the value "horizontal". |
import com.yahoo.maps.widgets.SatelliteControlWidget;
myMap.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_MAP_TYPE_CHANGED, onTypeChange);
var satControl = new SatelliteControlWidget(SatelliteControlWidget.HORIZONTAL); //arranges the widget buttons horizontally
function addNewWidget():Void {
myMap.addWidget(satControl);
}
function onTypeChange(event):Void {
var newType = event.view;
}
Returned when a geocode error has happened, suggested addresses can help narrow down possible values for the address that was originally entered.
| Method | Description |
|---|---|
| toString() | Returns a properly formatted address string representing the suggested address. |
| Property | Description |
|---|---|
| city | The city for the suggested address |
| country | The country for the suggested address |
| latlon | The latitude and longitude for the suggested address. |
| state | The state for the suggested address. |
| street | The street address for the suggested address. |
| zip | The zip for the suggested address. |
| zoomLevel | The zoom level for the suggested address. |
Tools allow the user to use the mouse to interact with the map. For example, the PanTool allows the user to pan the map by clicking and dragging the map.
| Method | Description |
|---|---|
| isInitialized() | A Boolean value stating whether the representative ActionScript object been created. Return value: boolean |
| JavaScript Only: getToolByJavaScriptId(javaScriptId) |
Returns the tool with the specified objects javaScriptId Return value: Tool |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Property | Description |
|---|---|
| EVENT_INITIALIZE | A static property containing the name of the initialize event |
| Event | Description |
|---|---|
| initialize | This event dispatches when the representative Tool object has been created. |
A widget that shows all the tools that have been added to the map by using Map.addTool() . It also allows users to select a tool and have that tool be set as the currently active tool.
| Method | Description |
|---|---|
| close() | Closes the toolbar Return value: void |
| open() | Opens the widget so that the user can see all the possible tools. Return value: void |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Widget | hide, isInitialized, isVisible, show |
import com.yahoo.maps.widgets.ToolBarWidget;
var toolbar = new ToolBarWidget();
function addToolBar():Void {
myMap.addWidget(toolbar);
}
Shows the traffic incidents reported for the currently viewable map area. This overlay is updated automatically whenever the map moves.
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Overlay | hide, isInitialized, isVisible, show |
import com.yahoo.maps.widgets.TrafficOverlay;
var trafficOverlay = new TrafficOverlay();
function addTraffic():Void {
myMap.addWidget(trafficOverlay);
}
A small black marker that displays a single index. Can be used for plotting distinct points on a map that need no description.
| Parameter | Description |
|---|---|
| waypointIndex | String that represents the current index for this waypoint. |
| Method | Description |
|---|---|
| setWaypointIndex(waypointIndex) | Updates the index that is displayed on the marker. Parameters:
Return value: void |
| getWaypointIndex() | Returns the current index for this waypoint. Return value: a string that represents the current index for this waypoint |
| Class | Inherited Methods |
|---|---|
| EventManager | addEventListener, removeAllEventListeners, removeEventListener |
| Marker | hide, isInitialized , isVisible, show |
import com.yahoo.maps.markers.WaypointMarker;
function addMarkers():Void {
myMap.addMarkerByAddress(WaypointMarker, "701 1st Ave, Sunnyvale, C