| Package | com.yahoo.maps.api |
| Class | public class YahooMap |
| Inheritance | YahooMap flash.display.Sprite |
| Implements | IYahooMap |
package {
import com.yahoo.maps.api.YahooMap;
import com.yahoo.maps.api.YahooMapEvent;
import com.yahoo.maps.api.core.location.LatLon;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class YahooMapExample extends Sprite
{
private var _map:YahooMap;
private static const APPID:String = "<your appid here>"; // Important, replace this value with your own application ID.
public function YahooMapExample()
{
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
_map = new YahooMap();
_map.addEventListener(YahooMapEvent.MAP_INITIALIZE, handleMapInitialize);
_map.init(APPID, this.stage.stageWidth, this.stage.stageHeight);
this.addChild(_map);
}
private function handleMapInitialize(event:YahooMapEvent):void
{
_map.addPanControl();
_map.zoomLevel = 6;
_map.centerLatLon = new LatLon(34.01,-118.49);
}
}
}
| Property | Defined by | ||
|---|---|---|---|
| appid : String
Your application ID.
| YahooMap | ||
| centerLatLon : LatLon
The center LatLon point of the map.
| YahooMap | ||
| centerOnDoubleClick : Boolean
Whether the map should automatically center on a double click event.
| YahooMap | ||
| config : MapConfig
[read-only]
A reference to the MapConfig object.
| YahooMap | ||
| container : DisplayObject [read-only]
| YahooMap | ||
| crosshairWidget : CrosshairWidget
[read-only]
The CrossHairWidget for the map.
| YahooMap | ||
| height : Number
The height of the map.
| YahooMap | ||
| initialized : Boolean [read-only]
Returns false if the map has not yet been initialized.
| YahooMap | ||
| keyboardControlsEnabled : Boolean
Enabled status of the MapKeyboardManager
| YahooMap | ||
| mapBase : MapBase [read-only]
The MapBase object containing the tile matrix.
| YahooMap | ||
| mapContainer : Sprite [read-only]
A Sprite containing the MapBase object
| YahooMap | ||
| mapHeight : Number [read-only]
The height of the map.
| YahooMap | ||
| mapType : String
The current map type
| YahooMap | ||
| mapTypeWidget : MapTypeWidget
[read-only]
The MapTypeControl widget for the map.
| YahooMap | ||
| mapWidth : Number [read-only]
The width of the map.
| YahooMap | ||
| markerContainer : Sprite [read-only]
A Sprite which contains the markers added to the map view.
| YahooMap | ||
| markerManager : MarkerManager
[read-only]
The maps MarkerManager
| YahooMap | ||
| overlayContainer : Sprite [read-only]
A Sprite which contains the overlays added to the map view.
| YahooMap | ||
| overlayManager : OverlayManager
[read-only]
The maps OverlayManager
| YahooMap | ||
| panControl : PanControl
[read-only]
Returns the PanControl object for the map.
| YahooMap | ||
| scaleBarWidget : ScaleBarWidget
[read-only]
The ScaleBarWidget for the map.
| YahooMap | ||
| widgetContainer : Sprite [read-only]
A Sprite which contains the widgets added to the map view.
| YahooMap | ||
| width : Number
The width of the map.
| YahooMap | ||
| zoomLevel : int
The current zoom level of the map
| YahooMap | ||
| zoomWidget : ZoomWidget
[read-only]
The ZoomControl widget for the map.
| YahooMap | ||
| Method | Defined by | ||
|---|---|---|---|
|
YahooMap()
Creates a new YahooMap object
| YahooMap | ||
|
addCrosshair():void
Adds a crosshair widget to the center of the map.
| YahooMap | ||
|
addPanControl():void
Adds panning abilities to the map, allowing it to be dragged and clicked on.
| YahooMap | ||
|
addScaleBar():void
Adds the ScaleBarWidget to the maps widget container
| YahooMap | ||
|
addTypeWidget():void
Removes the MapTypeControl from the maps widget container
| YahooMap | ||
|
addZoomWidget():void
Adds the ZoomControl to the maps widget container
| YahooMap | ||
|
destroy():void
Prepares the map for garbage-collection by removing references to child objects and containers.
| YahooMap | ||
|
getFeetToPixels(feet:Number, latitude:Number):Number
Converts a value in feet to pixels.
| YahooMap | ||
|
getKilometersToPixels(kilometers:Number, latitude:Number):Number
Converts a value in kilometers to pixels.
| YahooMap | ||
|
getLatLonToTileXY(latlon:LatLon):TileXY
Converts a LatLon to a TileXY object
| YahooMap | ||
|
getLatLonToXY(latlon:LatLon):Point
Converts a LatLon object to a point
| YahooMap | ||
|
Retrieves the bounds of the map.
| YahooMap | ||
|
getMetersToPixels(meters:Number, latitude:Number):Number
Converts a value in meters to pixels.
| YahooMap | ||
|
getMilesToPixels(miles:Number, latitude:Number):Number
Converts a value in miles to pixels.
| YahooMap | ||
|
getVersion():String
The current version of the API.
| YahooMap | ||
|
getXYToLatLon(point:Point):LatLon
Converts a Point to a LatLon object
| YahooMap | ||
|
getZoomRange():Array
Returns an array of zoom levels allowed on the map base.
| YahooMap | ||
|
init(appid:String, width:Number, height:Number, locale:String = "en"):void
Initializes the map given a YDN application ID, width, height and locale.
| YahooMap | ||
|
panToLatLon(latlon:LatLon, duration:Number = 250):Object
Smoothly pans the map to the specified location.
| YahooMap | ||
|
removeCrosshair():void
Removes the crosshair widget from the map.
| YahooMap | ||
|
removePanControl():void
Removes panning abilities from the map.
| YahooMap | ||
|
removeScaleBar():void
Removes the ScaleBarWidget from the maps widget container
| YahooMap | ||
|
removeTypeWidget():void
Adds the MapTypeControl to the maps widget container
| YahooMap | ||
|
removeZoomWidget():void
Removes the ZoomControl from the maps widget container
| YahooMap | ||
|
setCenterAddress(address:Address):void
Sets the map center by geocoding the address provided, and setting the maps centerLatLon when the geocoder responds.
| YahooMap | ||
|
setCenterByPixels(point:Point):void
Shifts the maps center point by the assigned delta point
| YahooMap | ||
|
setCenterWoeId(woeid:uint):void
Sets the center of the map to the provided WhereOnEarth identifier.
| YahooMap | ||
|
setHandCursor(value:Boolean):void
Sets the hand cursor visibility over the map
| YahooMap | ||
|
setMapBounds(bounds:BoundingBox):void
Sets the bounds of the map.
| YahooMap | ||
|
setSize(width:Number, height:Number):void
Sets the map size.
| YahooMap | ||
|
setZoomRange(minZoomLevel:Number, maxZoomLevel:Number):void
Sets the range of zoom levels allowed on the map base.
| YahooMap | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when the map configuration data fails to load or an error occured. | YahooMap | |||
| Dispatched when the map configuration data successfully loads. | YahooMap | |||
| Dispatched when a hybrid tile is loaded. | YahooMap | |||
| Dispatched when the map tile engine is initialized. | YahooMap | |||
| Dispatched when the map is being dragged. | YahooMap | |||
| Dispatched when the map starts dragging. | YahooMap | |||
| Dispatched when the map stops dragging. | YahooMap | |||
| Dispatched when the map is initialized and ready to be interacted with. | YahooMap | |||
| Dispatched when the map is clicked on. | YahooMap | |||
| Dispatched when the map is double-clicked on. | YahooMap | |||
| Dispatched when the mouse is pressed over the map. | YahooMap | |||
| Dispatched as the mouse moves over the map. | YahooMap | |||
| Dispatched when the mouse is released over the map. | YahooMap | |||
| Dispatched when the map is moved. | YahooMap | |||
| Dispatched when the map is resized. | YahooMap | |||
| Dispatched when a map or satellite tile is loaded. | YahooMap | |||
| Dispatched when all tiles have been loaded. | YahooMap | |||
| Dispatched when the current map view type has been changed. | YahooMap | |||
| Dispatched when the maps zoom level is changed. | YahooMap | |||
| Dispatched when a tile fails to load. | YahooMap | |||
| appid | property |
appid:String [read-write]Your application ID.
Implementation public function get appid():String
public function set appid(value:String):void
| centerLatLon | property |
centerLatLon:LatLon [read-write]The center LatLon point of the map.
Implementation public function get centerLatLon():LatLon
public function set centerLatLon(value:LatLon):void
See also
| centerOnDoubleClick | property |
centerOnDoubleClick:Boolean [read-write]Whether the map should automatically center on a double click event. (default=true)
Implementation public function get centerOnDoubleClick():Boolean
public function set centerOnDoubleClick(value:Boolean):void
| config | property |
config:MapConfig [read-only]A reference to the MapConfig object.
Implementation public function get config():MapConfig
| container | property |
container:DisplayObject [read-only]Implementation
public function get container():DisplayObject
| crosshairWidget | property |
crosshairWidget:CrosshairWidget [read-only]The CrossHairWidget for the map. This may be null if it hasn't been added yet.
Implementation public function get crosshairWidget():CrosshairWidget
| height | property |
height:Number [read-write]The height of the map.
Implementation public function get height():Number
public function set height(value:Number):void
| initialized | property |
initialized:Boolean [read-only]Returns false if the map has not yet been initialized.
Implementation public function get initialized():Boolean
| keyboardControlsEnabled | property |
keyboardControlsEnabled:Boolean [read-write]Enabled status of the MapKeyboardManager
Implementation public function get keyboardControlsEnabled():Boolean
public function set keyboardControlsEnabled(value:Boolean):void
See also
| mapBase | property |
mapBase:MapBase [read-only]The MapBase object containing the tile matrix.
Implementation public function get mapBase():MapBase
See also
| mapContainer | property |
mapContainer:Sprite [read-only]A Sprite containing the MapBase object
Implementation public function get mapContainer():Sprite
| mapHeight | property |
mapHeight:Number [read-only]The height of the map.
Implementation public function get mapHeight():Number
| mapType | property |
mapType:String [read-write]The current map type
Implementation public function get mapType():String
public function set mapType(value:String):void
See also
| mapTypeWidget | property |
mapTypeWidget:MapTypeWidget [read-only]The MapTypeControl widget for the map. This may be null if it hasn't been added yet.
Implementation public function get mapTypeWidget():MapTypeWidget
See also
| mapWidth | property |
mapWidth:Number [read-only]The width of the map.
Implementation public function get mapWidth():Number
| markerContainer | property |
markerContainer:Sprite [read-only]A Sprite which contains the markers added to the map view.
Implementation public function get markerContainer():Sprite
| markerManager | property |
markerManager:MarkerManager [read-only]The maps MarkerManager
Implementation public function get markerManager():MarkerManager
See also
| overlayContainer | property |
overlayContainer:Sprite [read-only]A Sprite which contains the overlays added to the map view.
Implementation public function get overlayContainer():Sprite
| overlayManager | property |
overlayManager:OverlayManager [read-only]The maps OverlayManager
Implementation public function get overlayManager():OverlayManager
See also
| panControl | property |
panControl:PanControl [read-only]Returns the PanControl object for the map.
Implementation public function get panControl():PanControl
See also
| scaleBarWidget | property |
scaleBarWidget:ScaleBarWidget [read-only]The ScaleBarWidget for the map. This may be null if it hasn't been added yet.
Implementation public function get scaleBarWidget():ScaleBarWidget
See also
| widgetContainer | property |
widgetContainer:Sprite [read-only]A Sprite which contains the widgets added to the map view.
Implementation public function get widgetContainer():Sprite
| width | property |
width:Number [read-write]The width of the map.
Implementation public function get width():Number
public function set width(value:Number):void
| zoomLevel | property |
zoomLevel:int [read-write]The current zoom level of the map
Implementation public function get zoomLevel():int
public function set zoomLevel(value:int):void
| zoomWidget | property |
zoomWidget:ZoomWidget [read-only]The ZoomControl widget for the map. This may be null if it hasn't been added yet.
Implementation public function get zoomWidget():ZoomWidget
See also
| YahooMap | () | constructor |
public function YahooMap()Creates a new YahooMap object
| addCrosshair | () | method |
public function addCrosshair():voidAdds a crosshair widget to the center of the map. (Since v0.9.2)
| addPanControl | () | method |
public function addPanControl():voidAdds panning abilities to the map, allowing it to be dragged and clicked on.
| addScaleBar | () | method |
public function addScaleBar():voidAdds the ScaleBarWidget to the maps widget container
| addTypeWidget | () | method |
public function addTypeWidget():voidRemoves the MapTypeControl from the maps widget container
| addZoomWidget | () | method |
public function addZoomWidget():voidAdds the ZoomControl to the maps widget container
| destroy | () | method |
public function destroy():voidPrepares the map for garbage-collection by removing references to child objects and containers.
| getFeetToPixels | () | method |
public function getFeetToPixels(feet:Number, latitude:Number):NumberConverts a value in feet to pixels.
Parametersfeet:Number — A distance in feet.
|
|
latitude:Number — The latitude in which to measure at. Defaults to the maps current center latitude.
|
Number |
| getKilometersToPixels | () | method |
public function getKilometersToPixels(kilometers:Number, latitude:Number):NumberConverts a value in kilometers to pixels.
Parameterskilometers:Number — A distance in kilometers.
|
|
latitude:Number — The latitude in which to measure at. Defaults to the maps current center latitude.
|
Number |
| getLatLonToTileXY | () | method |
public function getLatLonToTileXY(latlon:LatLon):TileXYConverts a LatLon to a TileXY object
Parameterslatlon:LatLon |
TileXY |
See also
| getLatLonToXY | () | method |
public function getLatLonToXY(latlon:LatLon):PointConverts a LatLon object to a point
Parameterslatlon:LatLon — A LatLon object.
|
Point — A Point object.
|
See also
| getMapBounds | () | method |
public function getMapBounds():BoundingBoxRetrieves the bounds of the map.
ReturnsBoundingBox |
See also
| getMetersToPixels | () | method |
public function getMetersToPixels(meters:Number, latitude:Number):NumberConverts a value in meters to pixels.
Parametersmeters:Number — A distance in meters.
|
|
latitude:Number — The latitude in which to measure at. Defaults to the maps current center latitude.
|
Number |
| getMilesToPixels | () | method |
public function getMilesToPixels(miles:Number, latitude:Number):NumberConverts a value in miles to pixels.
Parametersmiles:Number — A distance in miles.
|
|
latitude:Number — The latitude in which to measure at. Defaults to the maps current center latitude.
|
Number |
| getVersion | () | method |
public function getVersion():StringThe current version of the API.
ReturnsString |
| getXYToLatLon | () | method |
public function getXYToLatLon(point:Point):LatLonConverts a Point to a LatLon object
Parameterspoint:Point — A Point object.
|
LatLon —
A LatLon object.
|
| getZoomRange | () | method |
public function getZoomRange():ArrayReturns an array of zoom levels allowed on the map base.
ReturnsArray |
| init | () | method |
public function init(appid:String, width:Number, height:Number, locale:String = "en"):voidInitializes the map given a YDN application ID, width, height and locale.
Parametersappid:String — A required application ID registered through the Yahoo! Developer Network.
|
|
width:Number — The initial width of the map.
|
|
height:Number — The initial height of the map.
|
|
locale:String (default = "en") — (Optional) The locale of the map.
|
See also
| panToLatLon | () | method |
public function panToLatLon(latlon:LatLon, duration:Number = 250):ObjectSmoothly pans the map to the specified location.
Parameterslatlon:LatLon — The latitude/longitude to pan to.
|
|
duration:Number (default = 250) — The time in milleseconds to pan the map.
|
Object — An object containing the geographic distance of the map shift, pixel delta and the point delta objects.
|
See also
| removeCrosshair | () | method |
public function removeCrosshair():voidRemoves the crosshair widget from the map.
| removePanControl | () | method |
public function removePanControl():voidRemoves panning abilities from the map.
| removeScaleBar | () | method |
public function removeScaleBar():voidRemoves the ScaleBarWidget from the maps widget container
| removeTypeWidget | () | method |
public function removeTypeWidget():voidAdds the MapTypeControl to the maps widget container
| removeZoomWidget | () | method |
public function removeZoomWidget():voidRemoves the ZoomControl from the maps widget container
| setCenterAddress | () | method |
public function setCenterAddress(address:Address):voidSets the map center by geocoding the address provided, and setting the maps centerLatLon when the geocoder responds.
Parametersaddress:Address |
| setCenterByPixels | () | method |
public function setCenterByPixels(point:Point):voidShifts the maps center point by the assigned delta point
Parameterspoint:Point |
| setCenterWoeId | () | method |
public function setCenterWoeId(woeid:uint):voidSets the center of the map to the provided WhereOnEarth identifier.
Parameterswoeid:uint |
| setHandCursor | () | method |
public function setHandCursor(value:Boolean):voidSets the hand cursor visibility over the map
Parametersvalue:Boolean |
| setMapBounds | () | method |
public function setMapBounds(bounds:BoundingBox):voidSets the bounds of the map.
Parametersbounds:BoundingBox |
See also
| setSize | () | method |
public function setSize(width:Number, height:Number):voidSets the map size.
Parameterswidth:Number |
|
height:Number |
| setZoomRange | () | method |
public function setZoomRange(minZoomLevel:Number, maxZoomLevel:Number):voidSets the range of zoom levels allowed on the map base.
ParametersminZoomLevel:Number |
|
maxZoomLevel:Number |
| configFailure | event |
MapConfigEvent
Dispatched when the map configuration data fails to load or an error occured.
| configSuccess | event |
| hybridTileLoaded | event |
| mapBaseComplete | event |
| mapDrag | event |
YahooMapEvent
Dispatched when the map is being dragged. Requires that the pan control is enabled.
| mapDragStart | event |
YahooMapEvent
Dispatched when the map starts dragging. Requires that the pan control is enabled.
| mapDragStop | event |
YahooMapEvent
Dispatched when the map stops dragging. Requires that the pan control is enabled.
| mapInitialize | event |
YahooMapEvent
Dispatched when the map is initialized and ready to be interacted with.
| mapMouseClick | event |
YahooMapEvent
Dispatched when the map is clicked on. Requires that the pan control is enabled.
| mapMouseDoubleClick | event |
YahooMapEvent
Dispatched when the map is double-clicked on. Requires that the pan control is enabled.
| mapMouseDown | event |
YahooMapEvent
Dispatched when the mouse is pressed over the map. Requires that the pan control is enabled.
| mapMouseMove | event |
YahooMapEvent
Dispatched as the mouse moves over the map. Requires that the pan control is enabled.
| mapMouseUp | event |
YahooMapEvent
Dispatched when the mouse is released over the map. Requires that the pan control is enabled.
| mapMove | event |
| mapResize | event |
| mapTileLoaded | event |
| mapTilesLoaded | event |
| mapTypeChanged | event |
| mapZoom | event |
| tileLoadError | event |