My Account     Contact Us     Cart

Flash API Reference

This API documentation is designed to let you quickly start exploring and developing applications with the MAP Web Author JavaScript API. This documentation is designed for users familiar with JavaScript programming and object-oriented programming concepts. You should also be familiar with MAP Web Author from a user’s point of view. If you need more help, there are many JavaScript references available on the Web.

Contents

 

Reference

 

AVENZA.embedViewer(viewerId, width, height, viewerParams)

Inserts a viewer widget with the specified height and width in place of the DOM element with the specified id. The newly inserted element will have the same id as the one it replaced.

	<script> 
	    var mapObject = AVENZA.embedViewer("map", "650", "500", 
	        {
	            styleSheet:"map-viewer.css",
	            initialZoom:200,
	            zoomWidget:false, 
	            loadedCB: function () {
	                alert("Map has been loaded."); 
	            }
	        }
	    ); 
	</script>

	<div id="map"></div>

 

Arguments

Return

A reference to an AVENZA.Viewer object for the newly embedded viewer.

Since

8.2

 

AVENZA.Viewer(viewerId)

Constructs an object that can be used to control a viewer previously embedded in a web page with the given viewerId. Returns null if no element with that viewerId can be found.

	AVENZA.embedViewer("map", "650", "500");

	...

	var map = new AVENZA.Viewer("map");

 

Arguments

  • viewerId (String): the id of the viewer to associate with the object.

Since

8.2

 

AVENZA.Viewer.panRight()

Pans the viewer horizontally to the right by the number of pixels specified by panIncrement.

	<button type="button" onclick="map.panRight()">Pan Right</button> 

 

Since

8.2

 

AVENZA.Viewer.panLeft()

Pans the viewer horizontally to the left by the number of pixels specified by panIncrement.

	<button type="button" onclick="map.panLeft()">Pan Left</button> 

 

Since

8.2

 

AVENZA.Viewer.panUp()

Pans the viewer vertically upwards by the number of pixels specified by panIncrement.

	<button type="button" onclick="map.panUp()">Pan Up</button> 

 

Since

8.2

 

AVENZA.Viewer.panDown()

Pans the viewer vertically downwards by the number of pixels specified by panIncrement.

	<button type="button" onclick="map.panDown()">Pan Down</button> 

 

Since

8.2

 

AVENZA.Viewer.panHome()

Sets the viewer to the initial pan and zoom values specified by initialPanX, initialPanY and initialZoom.

	<button type="button" onclick="map.panHome()">Pan Home</button> 

 

Since

8.2

 

AVENZA.Viewer.zoomIn()

Zooms the viewer in by the percentage specified by zoomIncrement.

	<button type="button" onclick="map.zoomIn()">Zoom In</button> 

 

Since

8.2

 

AVENZA.Viewer.zoomOut()

Zooms the viewer out by the percentage specified by zoomIncrement.

	<button type="button" onclick="map.zoomOut()">Zoom Out</button> 

 

Since

8.2

 

AVENZA.Viewer.setVisible(layerName, visible)

Sets the visibility of the specified layer.

	map.setVisible("SubwayStations", false); 

 

Arguments

Since

8.2

 

AVENZA.Viewer.setAlpha(layerName, value)

Sets the opacity of the specified layer.

	// sets the Subway Stations layer to 30% opacity. 
	map.setAlpha("Subway Stations", 0.3); 

 

Arguments

Since

8.2

 

AVENZA.Viewer.subscribe(propertyType, functionName)

Subscribes to property events from the viewer. The function with the specified name will be called whenever the specified property changes. The property value can be updated by changing and returning the object passed.

Arguments

Since

8.2

 

AVENZA.Viewer.unsubscribe(propertyType, functionName)

Removes the specified function as a receiver of notifications when the specified viewer property changes.

	map.unsubscribe(AVENZA.FEATURE, "myFunction"); 

 

Arguments

Since

8.2

 

AVENZA.Viewer.retrieve(propertyType)

Retrieves the current value of the specified viewer property.

	var o = map.retrieve(AVENZA.ATTRIBUTES);

	if (o["State"]) {
	    alert(o["State"]);
	} 

 

Arguments

Return

The current value of the specified property.

Since

8.2

 

AVENZA.Viewer.element()

Returns the HTML DOM element of the viewer associated with the AVENZA.Viewer object. Use this method in place of document.getElementId().

	var theMapElement = map.element(); 

 

Return

The HTML DOM element of the map viewer.

Since

8.2

 

AVENZA.Viewer.tween(callback, startValue, endValue, duration) [PROVISIONAL]

The viewer’s internal animation engine will call the specified function with values progressing from startValue to endValue over the course of time specified. callback can be used to animate objects in the page that the viewer is embedded in. This method of animation is recommended because it will properly interleave with other animations that may be running in the viewer concurrently.

This API is provisional and may be modified or removed in a future release.

	// myCallback will be called with values between 
	// 0 and 100 over a period of 3 seconds.

	function myCallback(value) {
	    alert(value);
	}

	map.tween("myCallback", 0, 100, 3000);

 

Arguments

 

Since

8.2

 

AVENZA.Viewer.panToPointAndZoom(x, y, zoom)

Centers the viewer to the point x,y in the view and then zooms to the specified zoom level.

	// move the view to 42, 100 and zooms to 50%
	map.panToPointAndZoom(42, 100, 50);

 

Arguments

Since

8.2.1

 

Highlights features in the map with web tags that contain the passed search string.

	// highlight all parks
	map.search("park");

 

Arguments

Since

8.2.1

 

AVENZA.Viewer.features(selector, visibleLayersOnly)

Returns an object that can be used to manipulate features that match the passed selector.

// highlight all features with more men than women
map.features("male > female").highlight();

// clear the highlight for all features
map.features().highlight({visible: false});

 

Arguments

Return

An object that can used to manipulate the matched features. See AVENZA.Viewer.features().highlight() for more details.

Since

8.3

 

AVENZA.Viewer.features().forEach(visitor)

Runs the visitor function on every feature in the matching set.

// highlight all features with more men than women

function highlight_male(feature) {
	if (feature.attributes.male > feature.attributes.female) {
		feature.highlight.visible = true;
		return feature;
	}
}

map.features().forEach(highlight_male);

 

Arguments

Since

8.3

 

AVENZA.Viewer.features().highlight(style, style2)

Applies style to every feature in the matching set and, if it’s supplied, style2 to all other features.

// highlight all features based on the ratio of men to women
map.features("male > female").highlight(
	{visible: true, fillColor: "#89CFF0"},  // baby blue for mostly men
	{visible: true, fillColor: "#FFC0CB"} 	// pink for mostly women
);

 

Arguments

Since

8.3

 

AVENZA.Viewer.features().reveal(highlight, style)

Automatically pans and zooms the viewer to centre the matched features.

// Show montana in the viewer and highlight it red.
map.features('NAME="Montana"').reveal(
	true, 
	{
		visible: true, 
		fillColor: "#FF0000"
	}
);

 

Arguments

Since

8.3

 

AVENZA.Viewer.features().showCallout()

Displays a callout bubble for the matching features.

// Show callout bubble for Montana.
map.features('NAME="Montana"').showCallout();

 

Since

8.3

 

AVENZA.Viewer.currentFeature()

Returns an object that can be used to manipulate the feature that the mouse is currently over in the viewer.

map.currentFeature().highlight();

 

Since

8.3